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.cgi")
6 (defvar chise-wiki-add-url "add.cgi")
8 (defun www-display-char-desc (uri-char &optional lang level simple)
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)))
33 "<div style=\"text-align:right;\">
34 <a href=\"edit/view.cgi?char=%s\">
35 <input type=\"submit\" value=\"Edit\" />
37 <input type=\"submit\" value=\"New Account\" />
40 "<div style=\"text-align:right;\">
41 <a href=\"../view.cgi?char=%s\">
42 <input type=\"submit\" value=\"Simple\" />
47 (when (setq parents (www-char-feature char '<-denotational))
48 (princ (format "<p>%s %s</p>\n<hr>\n"
49 (www-format-value-as-char-list parents)
50 (www-format-feature-name '->denotational lang))))
51 (when (setq parents (www-char-feature char '<-subsumptive))
52 (princ (format "<p>%s %s</p>\n<hr>\n"
53 (www-format-value-as-char-list parents)
54 (www-format-feature-name '->subsumptive lang))))
55 (setq GlyphWiki-id (char-GlyphWiki-id char))
56 (princ (format "<h%d>%s%s</h%d>\n"
58 (www-format-encode-string (char-to-string char))
61 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
63 GlyphWiki-id GlyphWiki-id)
68 (dolist (cell (sort (char-attribute-alist char)
71 (char-feature-name-sans-versions (car a))
72 (char-feature-name-sans-versions (car b))))))
73 (setq logical-feature (char-feature-name-sans-versions (car cell)))
74 (unless (memq logical-feature displayed-features)
75 (push logical-feature displayed-features)
78 "<div class=\"feature\" style=\"line-height:150%\">\n"
82 (or (char-feature-property logical-feature ; (car cell)
84 '((name) " : " (value)))
86 logical-feature ; (car cell)
91 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
92 ><input type=\"submit\" value=\"note\" /></a>"
94 (www-format-encode-string uri-char)
95 (www-format-encode-string
96 (www-uri-encode-feature-name
97 (intern (format "%s*note"
98 logical-feature ; (car cell)
111 (format "<a href=\"%s?char=%s\"
112 ><input type=\"submit\" value=\"add feature\" /></a>
115 (www-format-encode-string uri-char))))
121 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
123 (www-format-encode-string
127 " <input type=\"text\" name=\"components\"
128 size=\"30\" maxlength=\"30\" value=\"%s\" />"
129 (encode-coding-string (char-to-string char) 'utf-8-jp-er)))
130 ;; (princ (www-format-encode-string "と"))
131 ;; (princ "<input type=\"text\" name=\"additional-components\"
132 size=\;; "30\" maxlength=\"30\" value=\"\" />")
134 (www-format-encode-string
135 "を\u542Bむ\u6F22\u5B57を\u63A2す"))
136 (princ " <input type=\"submit\" value=\"search\" />\n")
144 (defun www-display-feature-desc (uri-feature-name uri-char
145 &optional lang simple)
146 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
147 (name@lang (intern (format "name@%s" lang))))
149 (encode-coding-string
151 <title>CHISE-wiki feature: %s</title>
159 "<div style=\"text-align:right;\">
160 <a href=\"edit/view.cgi?feature=%s&char=%s\">
161 <input type=\"submit\" value=\"Edit\" />
163 <input type=\"submit\" value=\"New Account\" />
166 "<div style=\"text-align:right;\">
167 <a href=\"../view.cgi?feature=%s&char=%s\">
168 <input type=\"submit\" value=\"Simple\" />
172 uri-feature-name uri-char))
174 (format "<h1>%s</h1>\n"
175 (www-format-encode-string
176 (symbol-name feature-name))))
177 (princ (format "<p>name : %s "
178 (or (www-format-feature-name feature-name) "")))
182 " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
186 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
191 (www-format-encode-string
194 (or (char-feature-property feature-name name@lang) ""))))
198 " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
203 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
205 (www-html-display-paragraph
207 (or (www-feature-type feature-name)
208 ;; (char-feature-property feature-name 'type)
210 (princ (format "<p>value-format : %s "
213 (or (www-feature-value-format feature-name)
220 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
225 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
228 (princ "<p>format : ")
229 (www-html-display-text
231 (or (char-feature-property feature-name 'format)
232 '((name) " : " (value)))))
236 " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
241 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
244 (www-html-display-paragraph
245 (format "description : %s"
246 (or (char-feature-property feature-name 'description)
249 (www-html-display-paragraph
250 (format "description@%s : %s"
252 (or (char-feature-property
254 (intern (format "description@%s" lang)))
258 (defun www-batch-view ()
259 (setq terminal-coding-system 'binary)
261 (let* ((target (pop command-line-args-left))
262 (user (pop command-line-args-left))
263 (accept-language (pop command-line-args-left))
264 (mode (intern (pop command-line-args-left)))
269 (car (split-string accept-language ","))
273 (princ "Content-Type: text/html; charset=UTF-8
275 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
276 \"http://www.w3.org/TR/html4/loose.dtd\">
281 (when (string-match "^char=\\(&[^&;]+;\\)" target)
282 (setq ret (match-end 0))
286 (www-uri-decode-char (match-string 1 target)))
287 (substring target ret))))
289 (mapcar (lambda (cell)
290 (if (string-match "=" cell)
294 (substring cell 0 (match-beginning 0))
296 (substring cell (match-end 0)))
297 (list (decode-uri-string cell 'utf-8-mcs-er))))
298 (split-string target "&")))
299 (setq ret (car target))
300 (cond ((eq (car ret) 'char)
301 (www-display-char-desc
306 ((eq (car ret) 'feature)
307 (www-display-feature-desc
308 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
309 (cdr (assq 'char target))
315 (princ (format "mode=%S\n" mode))
316 (princ (format "user=%s\n" user))
317 ;; (princ (format "local user=%s\n" (user-login-name)))
318 (princ (format "lang=%S\n" lang))
319 (princ (emacs-version))
321 ;; (princ xemacs-chise-version)
327 (princ (format "%S" err)))
330 (provide 'cwiki-view)