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)
53 (char-attribute-name< (car a)(car b)))))
54 (setq logical-feature (char-feature-name-sans-versions (car cell)))
55 (unless (memq logical-feature displayed-features)
56 (push logical-feature displayed-features)
63 (or (char-feature-property logical-feature ; (car cell)
65 '((name) " : " (value)))
67 logical-feature ; (car cell)
70 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
71 ><input type=\"submit\" value=\"note\" /></a>"
73 (www-format-encode-string uri-char)
74 (www-format-encode-string
75 (www-uri-encode-feature-name
76 (intern (format "%s*note"
77 logical-feature ; (car cell)
89 (format "<a href=\"%s?char=%s\"
90 ><input type=\"submit\" value=\"add feature\" /></a>
93 (www-format-encode-string uri-char)))
99 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
101 (www-format-encode-string
105 " <input type=\"text\" name=\"components\"
106 size=\"30\" maxlength=\"30\" value=\"%s\" />"
107 (encode-coding-string (char-to-string char) 'utf-8-jp-er)))
108 ;; (princ (www-format-encode-string "と"))
109 ;; (princ "<input type=\"text\" name=\"additional-components\"
110 size=\;; "30\" maxlength=\"30\" value=\"\" />")
112 (www-format-encode-string
113 "を\u542Bむ\u6F22\u5B57を\u63A2す"))
114 (princ " <input type=\"submit\" value=\"search\" />\n")
122 (defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
123 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
124 (name@lang (intern (format "name@%s" lang))))
126 (encode-coding-string
128 <title>CHISE-wiki feature: %s</title>
134 (format "<h1>%s</h1>\n"
135 (www-format-encode-string
136 (symbol-name feature-name))))
137 (princ (format "<p>name : %s "
138 (or (www-format-feature-name feature-name) "")))
140 (format " <a href=\"%s?feature=%s&property=name&format=string&char=%s\"
141 ><input type=\"submit\" value=\"edit\" /></a>"
145 ;; (www-html-display-text
146 ;; (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
147 ;; ;; (char-feature-property feature-name 'name)
148 ;; chise-wiki-edit-url
149 ;; uri-feature-name ; (www-uri-encode-feature-name feature-name)
155 (www-format-encode-string
158 (or (char-feature-property feature-name name@lang) ""))))
160 (format " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\"
161 ><input type=\"submit\" value=\"edit\" /></a>"
166 ;; (www-html-display-text
167 ;; (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
168 ;; chise-wiki-edit-url
173 (www-html-display-paragraph
175 (or (www-feature-type feature-name)
176 ;; (char-feature-property feature-name 'type)
178 (princ (format "<p>value-format : %s "
181 (or (www-feature-value-format feature-name)
185 ;; (www-html-display-paragraph
186 ;; (format "value-format : %s"
187 ;; (www-xml-format-list
188 ;; (or (www-feature-value-format feature-name)
192 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
193 ><input type=\"submit\" value=\"edit\" /></a></p>"
198 (www-html-display-paragraph
199 (format "format : %s"
201 (or (char-feature-property feature-name 'format)
202 '((name) " : " (value))))))
203 (www-html-display-paragraph
204 (format "description : %s"
205 (or (char-feature-property feature-name 'description)
208 (www-html-display-paragraph
209 (format "description@%s : %s"
211 (or (char-feature-property
213 (intern (format "description@%s" lang)))
217 (defun www-batch-view ()
218 (setq terminal-coding-system 'binary)
220 (let* ((target (pop command-line-args-left))
221 (user (pop command-line-args-left))
222 (accept-language (pop command-line-args-left))
227 (car (split-string accept-language ","))
231 (princ "Content-Type: text/html; charset=UTF-8
233 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
234 \"http://www.w3.org/TR/html4/loose.dtd\">
240 (mapcar (lambda (cell)
241 (if (string-match "=" cell)
245 (substring cell 0 (match-beginning 0))
247 (substring cell (match-end 0)))
248 (list (decode-uri-string cell 'utf-8-mcs-er))))
249 (split-string target "&")))
250 (setq ret (car target))
251 (cond ((eq (car ret) 'char)
252 (www-display-char-desc
253 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
256 ((eq (car ret) 'feature)
257 (www-display-feature-desc
258 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
259 (cdr (assq 'char target))
260 ;; (decode-uri-string (cdr (assq 'char target)))
265 (princ (format "user=%s\n" user))
266 (princ (format "local user=%s\n" (user-login-name)))
267 (princ (format "lang=%S\n" lang))
268 (princ emacs-version)
270 (princ xemacs-chise-version)
276 (princ (format "%S" err)))
279 (provide 'cwiki-view)