1 ;; -*- coding: utf-8-mcs-er -*-
2 (defvar chise-wiki-view-url "../view.cgi")
3 (defvar chise-wiki-edit-url "edit.cgi")
5 (require 'cwiki-common)
7 (defun www-edit-display-char-feature-default (char feature-name &optional value
10 (setq value (char-feature char feature-name)))
11 (www-html-display-paragraph
12 (format "[[%s|%s?feature=%s]] : %s [[[edit|edit.cgi?char=%s&feature=%s]]]"
13 (www-format-feature-name feature-name lang)
15 (www-uri-encode-feature-name feature-name)
16 (www-format-value value feature-name nil 'without-tags)
18 (www-uri-encode-feature-name feature-name)
21 (defun www-edit-display-char-feature-as-ucs (char feature-name &optional value)
23 (setq value (char-feature char feature-name)))
24 (www-html-display-paragraph
25 (format "= [[U+%s|http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%s]] (%d)"
26 (www-format-value-as-HEX value)
27 (www-format-value-as-HEX value)
30 (defun www-edit-display-input-box (name value &optional format)
31 (when (stringp format)
32 (setq format (intern format)))
34 (if (or (eq format 'HEX)
38 (princ (www-format-encode-string
39 (format "%s \u2190 %s"
43 (format "<input type=\"text\" name=\"%s\"
44 size=\"30\" maxlength=\"30\" value=\"%s\">
45 <input type=\"submit\" value=\"set\" />
48 (www-format-encode-string
49 (format "%s" name) 'without-tags)
50 (www-format-apply-value format nil value
55 (defun www-edit-display-char-desc (uri-char uri-feature-name
56 &optional lang format)
57 (when (stringp format)
58 (setq format (intern format)))
59 (let ((char (www-uri-decode-char uri-char))
60 (feature-name (www-uri-decode-feature-name uri-feature-name))
61 base-name metadata-name
63 (when (characterp char)
66 <title>CHISE-wiki character: %s</title>
68 (www-format-encode-string uri-char 'without-tags)))
71 (format "<h1>%s</h1>\n"
72 (www-format-encode-string (char-to-string char))))
73 (princ "<form action=\"set.cgi\" method=\"GET\">\n")
76 (format "<p>(char : <input type=\"text\" name=\"char\"
77 size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
81 (setq char-spec (char-attribute-alist char))
82 (if (string-match "\\*" (setq str (symbol-name feature-name)))
83 (setq base-name (intern (substring str 0 (match-beginning 0)))
84 metadata-name (intern (substring str (match-end 0))))
85 (setq base-name feature-name))
86 (unless (assq base-name char-spec)
87 (setq char-spec (cons (cons base-name nil)
89 (dolist (cell (sort char-spec
91 (char-attribute-name< (car a)(car b)))))
93 ((eq (car cell) feature-name)
94 ;; (www-edit-display-input-box feature-name (cdr cell) format)
96 (format "<p><input type=\"text\" name=\"feature-name\"
97 size=\"30\" maxlength=\"30\" value=\"%s\">"
99 (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er))
101 (format "%s<input type=\"text\" name=\"%s\"
102 size=\"30\" maxlength=\"30\" value=\"%s\">
103 <input type=\"submit\" value=\"set\" /></p>
105 (if (or (eq format 'HEX)(eq format 'hex))
109 (www-format-value (cdr cell) feature-name
110 format 'without-tags)))
115 (www-format-eval-list
116 (or (char-feature-property (car cell) 'format)
117 '((name) " : " (value)))
118 char (car cell) lang uri-char))
120 (when (and (eq base-name (car cell)) metadata-name)
123 (www-edit-display-input-box feature-name
124 (char-feature char feature-name)
133 (defun www-edit-display-feature-desc (uri-feature-name
135 &optional lang uri-char)
136 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
137 (property-name (www-uri-decode-feature-name uri-property-name))
140 (encode-coding-string
142 <title>CHISE-wiki feature: %s</title>
147 (princ "<form action=\"set.cgi\" method=\"GET\">\n")
149 (encode-coding-string
150 (format "<h1>feature : <input type=\"text\" name=\"feature\"
151 size=\"30\" maxlength=\"30\" value=\"%s\"></h1>\n"
155 (encode-coding-string
156 (format "<p>(<input type=\"text\" name=\"char\"
157 size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
162 (if (eq property-name 'name)
163 (www-edit-display-input-box
165 (or (www-format-feature-name feature-name) ""))
166 (www-html-display-paragraph
167 (format "name : %s [[[edit|edit.cgi?feature=%s&property=name]]]"
168 (or (www-format-feature-name feature-name) "")
169 ;; (char-feature-property feature-name 'name)
170 uri-feature-name ; (www-uri-encode-feature-name feature-name)
173 (setq name@lang (intern (format "name@%s" lang)))
174 (if (eq property-name name@lang)
175 (www-edit-display-input-box
177 (or (char-feature-property feature-name name@lang) ""))
178 (www-html-display-paragraph
179 (format "%s : %s [[[edit|edit.cgi?feature=%s&property=%s]]]"
181 (or (char-feature-property feature-name name@lang) "")
184 (www-html-display-paragraph
186 (or (www-feature-type feature-name)
187 ;; (char-feature-property feature-name 'type)
189 (www-html-display-paragraph
190 (format "description : %s"
191 (or (char-feature-property feature-name 'description)
194 (www-html-display-paragraph
195 (format "description@%s : %s"
197 (or (char-feature-property
199 (intern (format "description@%s" lang)))
204 (defun www-batch-edit ()
205 (setq terminal-coding-system 'binary)
207 (let* ((target (pop command-line-args-left))
208 (user (pop command-line-args-left))
209 (accept-language (pop command-line-args-left))
211 (intern (car (split-string
213 (car (split-string accept-language ","))
217 (princ "Content-Type: text/html; charset=UTF-8
219 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
220 \"http://www.w3.org/TR/html4/loose.dtd\">
224 (mapcar (lambda (cell)
225 (if (string-match "=" cell)
229 (substring cell 0 (match-beginning 0))
231 (substring cell (match-end 0)))
232 (list (decode-uri-string cell 'utf-8-mcs-er))))
233 (split-string target "&")))
234 (setq ret (car target))
235 (cond ((eq (car ret) 'char)
236 (www-edit-display-char-desc
237 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
238 (decode-uri-string (cdr (assq 'feature target))
241 (decode-uri-string (cdr (assq 'format target))
244 ((eq (car ret) 'feature)
245 (www-edit-display-feature-desc
246 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
247 (decode-uri-string (cdr (assq 'property target))
250 (decode-uri-string (cdr (assq 'char target))
253 (www-html-display-paragraph
254 (format "%S" target))
256 (princ (format "user=%s\n" user))
257 (princ (format "local user=%s\n" (user-login-name)))
258 (princ (format "lang=%S\n" lang))
259 (princ emacs-version)
261 (princ xemacs-chise-version)
267 (princ (format "%S" err)))