From: MORIOKA Tomohiko Date: Mon, 13 Sep 2010 07:46:49 +0000 (+0900) Subject: New file. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=1662baf81ca538b8384053ce2ef5ee69ecbbf199;p=chise%2Fest.git New file. --- diff --git a/cwiki-add.el b/cwiki-add.el new file mode 100644 index 0000000..554d048 --- /dev/null +++ b/cwiki-add.el @@ -0,0 +1,129 @@ +;; -*- coding: utf-8-mcs-er -*- +(defvar chise-wiki-view-url "view.cgi") +(defvar chise-wiki-edit-url "edit.cgi") + +(require 'cwiki-common) + +(defun www-add-display-feature-input-box (char &optional format) + (unless format + (setq format 'default)) + (princ + "

") + (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er)) + (princ + (format "%s +

+" + (if (or (eq format 'HEX)(eq format 'hex)) + "0x" + "") + format)) + ) + +(defun www-add-display-char-desc (uri-char &optional lang format) + (when (stringp format) + (setq format (intern format))) + (let ((char (www-uri-decode-char uri-char)) + char-spec) + (when (characterp char) + (princ + (format " +CHISE-wiki character: %s +\n" + (encode-coding-string + (decode-uri-string uri-char 'utf-8-mcs-er) + 'utf-8-mcs-er))) + (princ "\n") + (princ + (format "

%s

\n" + (www-format-encode-string (char-to-string char)))) + (princ "
\n") + (princ + (encode-coding-string + (format "

(char : )

+" + (decode-uri-string uri-char 'utf-8-mcs-er)) + 'utf-8-mcs-er)) + (www-add-display-feature-input-box char format) + (setq char-spec (char-attribute-alist char)) + (dolist (cell (sort char-spec + (lambda (a b) + (char-attribute-name< (car a)(car b))))) + (princ "

") + (princ + (www-format-eval-list + (or (char-feature-property (car cell) 'format) + '((name) " : " (value))) + char (car cell) lang uri-char)) + (princ "

\n")) + (princ "
\n") + ))) + +(defun www-batch-add () + (setq terminal-coding-system 'binary) + (condition-case err + (let* ((target (pop command-line-args-left)) + (user (pop command-line-args-left)) + (accept-language (pop command-line-args-left)) + (lang + (intern (car (split-string + (car (split-string + (car (split-string accept-language ",")) + ";")) + "-")))) + ret) + (princ "Content-Type: text/html; charset=UTF-8 + + + +") + (setq target + (mapcar (lambda (cell) + (if (string-match "=" cell) + (cons + (intern + (decode-uri-string + (substring cell 0 (match-beginning 0)) + 'utf-8-mcs-er)) + (substring cell (match-end 0))) + (list (decode-uri-string cell 'utf-8-mcs-er)))) + (split-string target "&"))) + (setq ret (car target)) + (cond ((eq (car ret) 'char) + (www-add-display-char-desc + (cdr ret) + lang + (decode-uri-string (cdr (assq 'format target)) + 'utf-8-mcs-er)) + ) + ;; ((eq (car ret) 'feature) + ;; (www-add-display-feature-desc + ;; (decode-uri-string (cdr ret) 'utf-8-mcs-er) + ;; (decode-uri-string (cdr (assq 'property target)) + ;; 'utf-8-mcs-er) + ;; lang + ;; (cdr (assq 'char target)) + ;; ;; (decode-uri-string (cdr (assq 'char target)) + ;; ;; 'utf-8-mcs-er) + ;; )) + ) + (www-html-display-paragraph + (format "%S" target)) + (princ "\n
\n") + (princ (format "user=%s\n" user)) + (princ (format "local user=%s\n" (user-login-name))) + (princ (format "lang=%S\n" lang)) + (princ emacs-version) + (princ " CHISE ") + (princ xemacs-chise-version) + (princ " + +") + ) + (error nil + (princ (format "%S" err))) + ))