1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-common)
4 (defvar chise-wiki-view-url "view.cgi")
5 (defvar chise-wiki-edit-url "edit/edit.cgi")
6 (defvar chise-wiki-add-url "edit/add.cgi")
8 (defun www-display-char-desc (uri-char &optional lang level)
11 (let ((char (www-uri-decode-char uri-char))
12 logical-feature displayed-features
15 (when (characterp char)
16 (when (= (length uri-char) 1)
17 (setq uri-char (www-uri-encode-char char)))
22 <title>CHISE-wiki character: %s</title>
24 (decode-uri-string uri-char 'utf-8-mcs-er))
27 (dolist (feature (char-feature-property '$object 'additional-features))
28 (mount-char-attribute-table
29 (char-feature-name-at-domain feature '$rev=latest)))
30 (when (setq parents (www-char-feature char '<-denotational))
31 (princ (format "<p>%s %s</p>\n<hr>\n"
32 (www-format-value-as-char-list parents)
33 (www-format-feature-name '->denotational lang))))
34 (when (setq parents (www-char-feature char '<-subsumptive))
35 (princ (format "<p>%s %s</p>\n<hr>\n"
36 (www-format-value-as-char-list parents)
37 (www-format-feature-name '->subsumptive lang))))
38 (setq GlyphWiki-id (char-GlyphWiki-id char))
39 (princ (format "<h%d>%s%s</h%d>\n"
41 (www-format-encode-string (char-to-string char))
44 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
46 GlyphWiki-id GlyphWiki-id)
51 (dolist (cell (sort (char-attribute-alist char)
54 (char-feature-name-sans-versions (car a))
55 (char-feature-name-sans-versions (car b))))))
56 (setq logical-feature (char-feature-name-sans-versions (car cell)))
57 (unless (memq logical-feature displayed-features)
58 (push logical-feature displayed-features)
65 (or (char-feature-property logical-feature ; (car cell)
67 '((name) " : " (value)))
69 logical-feature ; (car cell)
72 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
73 ><input type=\"submit\" value=\"note\" /></a>"
75 (www-format-encode-string uri-char)
76 (www-format-encode-string
77 (www-uri-encode-feature-name
78 (intern (format "%s*note"
79 logical-feature ; (car cell)
91 (format "<a href=\"%s?char=%s\"
92 ><input type=\"submit\" value=\"add feature\" /></a>
95 (www-format-encode-string uri-char)))
101 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
103 (www-format-encode-string
107 " <input type=\"text\" name=\"components\"
108 size=\"30\" maxlength=\"30\" value=\"%s\" />"
109 (encode-coding-string (char-to-string char) 'utf-8-jp-er)))
110 ;; (princ (www-format-encode-string "と"))
111 ;; (princ "<input type=\"text\" name=\"additional-components\"
112 size=\;; "30\" maxlength=\"30\" value=\"\" />")
114 (www-format-encode-string
115 "を\u542Bむ\u6F22\u5B57を\u63A2す"))
116 (princ " <input type=\"submit\" value=\"search\" />\n")
124 (defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
125 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
126 (name@lang (intern (format "name@%s" lang))))
128 (encode-coding-string
130 <title>CHISE-wiki feature: %s</title>
136 (format "<h1>%s</h1>\n"
137 (www-format-encode-string
138 (symbol-name feature-name))))
139 (princ (format "<p>name : %s "
140 (or (www-format-feature-name feature-name) "")))
142 (format " <a href=\"%s?feature=%s&property=name&format=string&char=%s\"
143 ><input type=\"submit\" value=\"edit\" /></a>"
147 ;; (www-html-display-text
148 ;; (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
149 ;; ;; (char-feature-property feature-name 'name)
150 ;; chise-wiki-edit-url
151 ;; uri-feature-name ; (www-uri-encode-feature-name feature-name)
157 (www-format-encode-string
160 (or (char-feature-property feature-name name@lang) ""))))
162 (format " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\"
163 ><input type=\"submit\" value=\"edit\" /></a>"
168 ;; (www-html-display-text
169 ;; (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
170 ;; chise-wiki-edit-url
175 (www-html-display-paragraph
177 (or (www-feature-type feature-name)
178 ;; (char-feature-property feature-name 'type)
180 (princ (format "<p>value-format : %s "
183 (or (www-feature-value-format feature-name)
187 ;; (www-html-display-paragraph
188 ;; (format "value-format : %s"
189 ;; (www-xml-format-list
190 ;; (or (www-feature-value-format feature-name)
194 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
195 ><input type=\"submit\" value=\"edit\" /></a></p>"
200 (www-html-display-paragraph
201 (format "format : %s"
203 (or (char-feature-property feature-name 'format)
204 '((name) " : " (value))))))
205 (www-html-display-paragraph
206 (format "description : %s"
207 (or (char-feature-property feature-name 'description)
210 (www-html-display-paragraph
211 (format "description@%s : %s"
213 (or (char-feature-property
215 (intern (format "description@%s" lang)))
219 (defun www-batch-view ()
220 (setq terminal-coding-system 'binary)
222 (let* ((target (pop command-line-args-left))
223 (user (pop command-line-args-left))
224 (accept-language (pop command-line-args-left))
229 (car (split-string accept-language ","))
233 (princ "Content-Type: text/html; charset=UTF-8
235 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
236 \"http://www.w3.org/TR/html4/loose.dtd\">
242 (mapcar (lambda (cell)
243 (if (string-match "=" cell)
247 (substring cell 0 (match-beginning 0))
249 (substring cell (match-end 0)))
250 (list (decode-uri-string cell 'utf-8-mcs-er))))
251 (split-string target "&")))
252 (setq ret (car target))
253 (cond ((eq (car ret) 'char)
254 (www-display-char-desc
255 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
258 ((eq (car ret) 'feature)
259 (www-display-feature-desc
260 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
261 (cdr (assq 'char target))
262 ;; (decode-uri-string (cdr (assq 'char target)))
267 (princ (format "user=%s\n" user))
268 (princ (format "local user=%s\n" (user-login-name)))
269 (princ (format "lang=%S\n" lang))
270 (princ emacs-version)
272 (princ xemacs-chise-version)
278 (princ (format "%S" err)))
281 (provide 'cwiki-view)