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 (char-to-string object))
65 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
67 GlyphWiki-id GlyphWiki-id)
72 (dolist (cell (sort (if (eq genre 'character)
73 (char-attribute-alist object)
74 (concord-object-spec object))
77 (char-feature-name-sans-versions (car a))
78 (char-feature-name-sans-versions (car b))))))
79 (setq logical-feature (char-feature-name-sans-versions (car cell)))
80 (unless (memq logical-feature chise-wiki-displayed-features)
81 (push logical-feature chise-wiki-displayed-features)
84 "<div class=\"feature\" style=\"line-height:150%\">\n"
88 (www-feature-format logical-feature)
90 logical-feature ; (car cell)
95 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
96 ><input type=\"submit\" value=\"note\" /></a>"
98 (www-format-encode-string uri-object)
99 (www-format-encode-string
100 (www-uri-encode-feature-name
101 (intern (format "%s*note"
102 logical-feature ; (car cell)
115 (format "<a href=\"%s?char=%s\"
116 ><input type=\"submit\" value=\"add feature\" /></a>
119 (www-format-encode-string uri-object))))
125 "<form action=\"http://chise.zinbun.kyoto-u.ac.jp/ids-find\">\n")
127 (www-format-encode-string
128 (format "%c" object)))
131 " <input type=\"text\" name=\"components\"
132 size=\"30\" maxlength=\"30\" value=\"%s\" />"
133 (encode-coding-string (char-to-string object) 'utf-8-jp-er)))
135 (www-format-encode-string
136 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
137 (princ " <input type=\"submit\" value=\"search\" />\n")
145 (defun www-display-feature-desc (uri-feature-name uri-object
146 &optional lang simple)
147 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
148 (name@lang (intern (format "name@%s" lang))))
150 (encode-coding-string
152 <title>EsT feature: %s</title>
160 "<div style=\"text-align:right;\">
161 <a href=\"edit/view.cgi?feature=%s&char=%s\">
162 <input type=\"submit\" value=\"Edit\" />
164 <input type=\"submit\" value=\"New Account\" />
167 "<div style=\"text-align:right;\">
168 <a href=\"../view.cgi?feature=%s&char=%s\">
169 <input type=\"submit\" value=\"Simple\" />
173 uri-feature-name uri-object))
175 (format "<h1>%s</h1>\n"
176 (www-format-encode-string
177 (symbol-name feature-name))))
178 (princ (format "<p>name : %s "
179 (or (www-format-feature-name feature-name) "")))
183 " <a href=\"%s?feature=%s&property=name&format=string&char=%s\">"
187 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
192 (www-format-encode-string
195 (or (char-feature-property feature-name name@lang) ""))))
199 " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\">"
204 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
206 (www-html-display-paragraph
208 (or (www-feature-type feature-name)
209 ;; (char-feature-property feature-name 'type)
211 (princ (format "<p>value-format : %s "
214 (or (www-feature-value-format feature-name)
221 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
226 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
229 (princ "<p>format : ")
230 (www-html-display-text
231 (decode-coding-string
233 (www-feature-format feature-name))
238 " <a href=\"%s?feature=%s&property=format&format=wiki-text&char=%s\"
243 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
246 (www-html-display-paragraph
247 (format "description : %s"
248 (or (char-feature-property feature-name 'description)
251 (www-html-display-paragraph
252 (format "description@%s : %s"
254 (or (char-feature-property
256 (intern (format "description@%s" lang)))
260 (defun www-batch-view ()
261 (setq terminal-coding-system 'binary)
263 (let* ((target (pop command-line-args-left))
264 (user (pop command-line-args-left))
265 (accept-language (pop command-line-args-left))
266 (mode (intern (pop command-line-args-left)))
271 (car (split-string accept-language ","))
275 (princ "Content-Type: text/html; charset=UTF-8
277 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
278 \"http://www.w3.org/TR/html4/loose.dtd\">
283 (when (string-match "^char=\\(&[^&;]+;\\)" target)
284 (setq ret (match-end 0))
288 (www-uri-decode-object
289 'character (match-string 1 target)))
290 (substring target ret))))
292 (mapcar (lambda (cell)
293 (if (string-match "=" cell)
297 (substring cell 0 (match-beginning 0))
299 (substring cell (match-end 0)))
300 (list (decode-uri-string cell 'utf-8-mcs-er))))
301 (split-string target "&")))
302 (setq ret (car target))
303 (cond ((eq (car ret) 'char)
304 (www-display-object-desc
310 ((eq (car ret) 'feature)
311 (www-display-feature-desc
312 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
313 (cdr (assq 'char target))
319 (princ (format "mode=%S\n" mode))
320 (princ (format "user=%s\n" user))
321 ;; (princ (format "local user=%s\n" (user-login-name)))
322 (princ (format "lang=%S\n" lang))
323 (princ (emacs-version))
325 ;; (princ xemacs-chise-version)
331 (princ (format "%S" err)))
334 (provide 'cwiki-view)