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-char 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 (if (eq genre 'character)
64 (char-to-string object)
65 (format "%s" (concord-object-id object))))
68 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
70 GlyphWiki-id GlyphWiki-id)
75 (dolist (cell (sort (if (eq genre 'character)
76 (char-attribute-alist object)
77 (concord-object-spec object))
80 (char-feature-name-sans-versions (car a))
81 (char-feature-name-sans-versions (car b))))))
82 (setq logical-feature (char-feature-name-sans-versions (car cell)))
83 (unless (memq logical-feature chise-wiki-displayed-features)
84 (push logical-feature chise-wiki-displayed-features)
87 "<div class=\"feature\" style=\"line-height:150%\">\n"
91 (www-feature-format logical-feature)
93 logical-feature ; (car cell)
98 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
99 ><input type=\"submit\" value=\"note\" /></a>"
101 (www-format-encode-string uri-object)
102 (www-format-encode-string
103 (www-uri-encode-feature-name
104 (intern (format "%s*note"
105 logical-feature ; (car cell)
118 (format "<a href=\"%s?char=%s\"
119 ><input type=\"submit\" value=\"add feature\" /></a>
122 (www-format-encode-string uri-object))))
128 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
130 (www-format-encode-string
131 (if (eq genre 'character)
133 (format "%s" (concord-object-id object)))))
136 " <input type=\"text\" name=\"components\"
137 size=\"30\" maxlength=\"30\" value=\"%s\" />"
138 (encode-coding-string
139 (if (eq genre 'character)
140 (char-to-string object)
141 (format "%s" (concord-object-id object)))
144 (www-format-encode-string
145 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
146 (princ " <input type=\"submit\" value=\"search\" />\n")
154 (defun www-display-feature-desc (uri-feature-name uri-object
155 &optional lang simple)
156 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
157 (name@lang (intern (format "name@%s" lang))))
159 (encode-coding-string
161 <title>EsT feature: %s</title>
169 "<div style=\"text-align:right;\">
170 <a href=\"edit/view.cgi?feature=%s&char=%s\">
171 <input type=\"submit\" value=\"Edit\" />
173 <input type=\"submit\" value=\"New Account\" />
176 "<div style=\"text-align:right;\">
177 <a href=\"../view.cgi?feature=%s&char=%s\">
178 <input type=\"submit\" value=\"Simple\" />
182 uri-feature-name uri-object))
184 (format "<h1>%s</h1>\n"
185 (www-format-encode-string
186 (symbol-name feature-name))))
187 (princ (format "<p>name : %s "
188 (or (www-format-feature-name feature-name) "")))
192 " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
196 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
201 (www-format-encode-string
204 (or (char-feature-property feature-name name@lang) ""))))
208 " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
213 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
215 (www-html-display-paragraph
217 (or (www-feature-type feature-name)
218 ;; (char-feature-property feature-name 'type)
220 (princ (format "<p>value-format : %s "
223 (or (www-feature-value-format feature-name)
230 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
235 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
238 (princ "<p>format : ")
239 (www-html-display-text
240 (decode-coding-string
242 (www-feature-format feature-name))
247 " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
252 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
255 (www-html-display-paragraph
256 (format "description : %s"
257 (or (char-feature-property feature-name 'description)
260 (www-html-display-paragraph
261 (format "description@%s : %s"
263 (or (char-feature-property
265 (intern (format "description@%s" lang)))
269 (defun www-batch-view ()
270 (setq terminal-coding-system 'binary)
272 (let* ((target (pop command-line-args-left))
273 (user (pop command-line-args-left))
274 (accept-language (pop command-line-args-left))
275 (mode (intern (pop command-line-args-left)))
280 (car (split-string accept-language ","))
284 (princ "Content-Type: text/html; charset=UTF-8
286 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
287 \"http://www.w3.org/TR/html4/loose.dtd\">
292 (when (string-match "^char=\\(&[^&;]+;\\)" target)
293 (setq ret (match-end 0))
297 (www-uri-decode-object
298 'character (match-string 1 target)))
299 (substring target ret))))
301 (mapcar (lambda (cell)
302 (if (string-match "=" cell)
306 (substring cell 0 (match-beginning 0))
308 (substring cell (match-end 0)))
309 (list (decode-uri-string cell 'utf-8-mcs-er))))
310 (split-string target "&")))
311 (setq ret (car target))
312 (cond ((eq (car ret) 'char)
313 (www-display-object-desc
319 ((eq (car ret) 'feature)
320 (www-display-feature-desc
321 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
322 (cdr (assq 'char target))
327 (www-display-object-desc
335 (princ (format "mode=%S\n" mode))
336 (princ (format "user=%s\n" user))
337 ;; (princ (format "local user=%s\n" (user-login-name)))
338 (princ (format "lang=%S\n" lang))
339 (princ (emacs-version))
341 ;; (princ xemacs-chise-version)
347 (princ (format "%S" err)))
350 (provide 'cwiki-view)