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-object-desc (genre uri-object &optional lang level simple)
11 (let ((object (www-uri-decode-object genre uri-object))
12 logical-feature chise-wiki-displayed-features
16 (when (and (eq genre 'character)
17 (= (length uri-object) 1))
18 (setq uri-object (www-uri-encode-object object)))
23 <title>EsT %s = %s</title>
26 (decode-uri-string uri-object 'utf-8-mcs-er))
29 (when (eq genre 'character)
30 (dolist (feature (char-feature-property '$object 'additional-features))
31 (mount-char-attribute-table
32 (char-feature-name-at-domain feature '$rev=latest))))
36 "<div style=\"text-align:right;\">
37 <a href=\"edit/view.cgi?char=%s\">
38 <input type=\"submit\" value=\"Edit\" />
40 <input type=\"submit\" value=\"New Account\" />
43 "<div style=\"text-align:right;\">
44 <a href=\"../view.cgi?char=%s\">
45 <input type=\"submit\" value=\"Simple\" />
50 (when (setq parents (www-get-feature-value object '<-denotational))
51 (princ (format "<p>%s %s</p>\n<hr>\n"
52 (www-format-value-as-char-list parents)
53 (www-format-feature-name '->denotational lang))))
54 (when (setq parents (www-get-feature-value object '<-subsumptive))
55 (princ (format "<p>%s %s</p>\n<hr>\n"
56 (www-format-value-as-char-list parents)
57 (www-format-feature-name '->subsumptive lang))))
58 (when (eq genre 'character)
59 (setq GlyphWiki-id (char-GlyphWiki-id object)))
60 (princ (format "<h%d>%s%s</h%d>\n"
62 (www-format-encode-string
63 (est-format-object object)
64 ;; (if (eq genre 'character)
65 ;; (char-to-string object)
66 ;; (format "%s" (concord-object-id object)))
70 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
72 GlyphWiki-id GlyphWiki-id)
77 (dolist (cell (sort (if (eq genre 'character)
78 (char-attribute-alist object)
79 (concord-object-spec object))
82 (char-feature-name-sans-versions (car a))
83 (char-feature-name-sans-versions (car b))))))
84 (setq logical-feature (char-feature-name-sans-versions (car cell)))
85 (unless (memq logical-feature chise-wiki-displayed-features)
86 (push logical-feature chise-wiki-displayed-features)
89 "<div class=\"feature\" style=\"line-height:150%\">\n"
93 (www-feature-format logical-feature)
95 logical-feature ; (car cell)
100 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
101 ><input type=\"submit\" value=\"note\" /></a>"
103 (www-format-encode-string uri-object)
104 (www-format-encode-string
105 (www-uri-encode-feature-name
106 (intern (format "%s*note"
107 logical-feature ; (car cell)
120 (format "<a href=\"%s?char=%s\"
121 ><input type=\"submit\" value=\"add feature\" /></a>
124 (www-format-encode-string uri-object))))
130 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
132 (www-format-encode-string
133 (est-format-object object)
134 ;; (if (eq genre 'character)
135 ;; (format "%c" object)
136 ;; (format "%s" (concord-object-id object)))
140 " <input type=\"text\" name=\"components\"
141 size=\"30\" maxlength=\"30\" value=\"%s\" />"
142 (encode-coding-string
143 (est-format-object object)
144 ;; (if (eq genre 'character)
145 ;; (char-to-string object)
146 ;; (format "%s" (concord-object-id object)))
149 (www-format-encode-string
150 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
151 (princ " <input type=\"submit\" value=\"search\" />\n")
159 (defun www-display-feature-desc (uri-feature-name uri-object
160 &optional lang simple)
161 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
162 (name@lang (intern (format "name@%s" lang))))
164 (encode-coding-string
166 <title>EsT feature: %s</title>
174 "<div style=\"text-align:right;\">
175 <a href=\"edit/view.cgi?feature=%s&char=%s\">
176 <input type=\"submit\" value=\"Edit\" />
178 <input type=\"submit\" value=\"New Account\" />
181 "<div style=\"text-align:right;\">
182 <a href=\"../view.cgi?feature=%s&char=%s\">
183 <input type=\"submit\" value=\"Simple\" />
187 uri-feature-name uri-object))
189 (format "<h1>%s</h1>\n"
190 (www-format-encode-string
191 (symbol-name feature-name))))
192 (princ (format "<p>name : %s "
193 (or (www-format-feature-name feature-name) "")))
197 " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
201 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
206 (www-format-encode-string
209 (or (char-feature-property feature-name name@lang) ""))))
213 " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
218 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
220 (www-html-display-paragraph
222 (or (www-feature-type feature-name)
223 ;; (char-feature-property feature-name 'type)
225 (princ (format "<p>value-format : %s "
228 (or (www-feature-value-format feature-name)
235 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
240 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
243 (princ "<p>format : ")
244 (www-html-display-text
245 (decode-coding-string
247 (www-feature-format feature-name))
252 " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
257 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
260 (www-html-display-paragraph
261 (format "description : %s"
262 (or (char-feature-property feature-name 'description)
265 (www-html-display-paragraph
266 (format "description@%s : %s"
268 (or (char-feature-property
270 (intern (format "description@%s" lang)))
274 (defun www-batch-view ()
275 (setq terminal-coding-system 'binary)
277 (let* ((target (pop command-line-args-left))
278 (user (pop command-line-args-left))
279 (accept-language (pop command-line-args-left))
280 (mode (intern (pop command-line-args-left)))
285 (car (split-string accept-language ","))
289 (princ "Content-Type: text/html; charset=UTF-8
291 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
292 \"http://www.w3.org/TR/html4/loose.dtd\">
297 (when (string-match "^char=\\(&[^&;]+;\\)" target)
298 (setq ret (match-end 0))
301 (www-uri-encode-object
302 (www-uri-decode-object
303 'character (match-string 1 target)))
304 (substring target ret))))
306 (mapcar (lambda (cell)
307 (if (string-match "=" cell)
311 (substring cell 0 (match-beginning 0))
313 (substring cell (match-end 0)))
314 (list (decode-uri-string cell 'utf-8-mcs-er))))
315 (split-string target "&")))
316 (setq ret (car target))
317 (cond ((eq (car ret) 'char)
318 (www-display-object-desc
324 ((eq (car ret) 'feature)
325 (www-display-feature-desc
326 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
327 (cdr (assq 'char target))
332 (www-display-object-desc
340 (princ (format "mode=%S\n" mode))
341 (princ (format "user=%s\n" user))
342 ;; (princ (format "local user=%s\n" (user-login-name)))
343 (princ (format "lang=%S\n" lang))
344 (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
346 ;; (princ xemacs-chise-version)
352 (princ (format "%S" err)))
355 (provide 'cwiki-view)