1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-format)
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?%s=%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?%s=%s\">
45 <input type=\"submit\" value=\"Simple\" />
51 (when (setq parents (www-get-feature-value object '<-denotational))
52 (princ (format "<p>%s %s</p>\n<hr>\n"
53 (www-format-value-as-char-list parents)
54 (www-format-feature-name '->denotational lang))))
55 (when (setq parents (www-get-feature-value object '<-subsumptive))
56 (princ (format "<p>%s %s</p>\n<hr>\n"
57 (www-format-value-as-char-list parents)
58 (www-format-feature-name '->subsumptive lang))))
59 (when (eq genre 'character)
60 (setq GlyphWiki-id (char-GlyphWiki-id object)))
61 (princ (format "<h%d>%s%s</h%d>\n"
63 (www-format-encode-string
64 (est-format-object object)
65 ;; (if (eq genre 'character)
66 ;; (char-to-string object)
67 ;; (format "%s" (concord-object-id object)))
71 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
73 GlyphWiki-id GlyphWiki-id)
78 (dolist (cell (sort (if (eq genre 'character)
79 (char-attribute-alist object)
80 (concord-object-spec object))
83 (char-feature-name-sans-versions (car a))
84 (char-feature-name-sans-versions (car b))))))
85 (setq logical-feature (char-feature-name-sans-versions (car cell)))
86 (unless (memq logical-feature chise-wiki-displayed-features)
87 (push logical-feature chise-wiki-displayed-features)
90 "<div class=\"feature\" style=\"line-height:150%\">\n"
94 (www-feature-format logical-feature)
96 logical-feature ; (car cell)
101 (format " <a href=\"%s?%s=%s&feature=%s&format=wiki-text\"
102 ><input type=\"submit\" value=\"note\" /></a>"
105 (www-format-encode-string uri-object)
106 (www-format-encode-string
107 (www-uri-encode-feature-name
108 (intern (format "%s*note"
109 logical-feature ; (car cell)
122 (format "<a href=\"%s?%s=%s\"
123 ><input type=\"submit\" value=\"add feature\" /></a>
127 (www-format-encode-string uri-object))))
132 (when (eq genre 'character)
134 "<form action=\"http://www.chise.org/ids-find\">\n")
136 (www-format-encode-string
137 (est-format-object object)
138 ;; (if (eq genre 'character)
139 ;; (format "%c" object)
140 ;; (format "%s" (concord-object-id object)))
144 " <input type=\"text\" name=\"components\"
145 size=\"30\" maxlength=\"30\" value=\"%s\" />"
146 (encode-coding-string
147 (est-format-object object)
148 ;; (if (eq genre 'character)
149 ;; (char-to-string object)
150 ;; (format "%s" (concord-object-id object)))
153 (www-format-encode-string
154 "ă\u542Bă\u6F22\u5B57ă\u63A2ă"))
155 (princ " <input type=\"submit\" value=\"search\" />\n")
163 (defun www-display-feature-desc (uri-feature-name genre uri-object
164 &optional lang simple)
165 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
166 (name@lang (intern (format "name@%s" lang))))
168 (encode-coding-string
170 <title>EsT feature: %s</title>
178 "<div style=\"text-align:right;\">
179 <a href=\"edit/view.cgi?feature=%s&%s=%s\">
180 <input type=\"submit\" value=\"Edit\" />
182 <input type=\"submit\" value=\"New Account\" />
185 "<div style=\"text-align:right;\">
186 <a href=\"../view.cgi?feature=%s&%s=%s\">
187 <input type=\"submit\" value=\"Simple\" />
191 uri-feature-name genre uri-object))
193 (format "<h1>%s</h1>\n"
194 (www-format-encode-string
195 (symbol-name feature-name))))
196 (princ (format "<p>name : %s "
197 (or (www-format-feature-name feature-name) "")))
201 " <a href=\"%s?feature=%s&property=name&format=string&%s=%s\">"
206 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
211 (www-format-encode-string
214 (or (char-feature-property feature-name name@lang) ""))))
218 " <a href=\"%s?feature=%s&property=%s&format=string&%s=%s\">"
224 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
226 (www-html-display-paragraph
228 (or (www-feature-type feature-name)
229 ;; (char-feature-property feature-name 'type)
231 (princ (format "<p>value-format : %s "
234 (or (www-feature-value-format feature-name)
241 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&%s=%s\"
247 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
250 (princ "<p>format : ")
251 (www-html-display-text
252 (decode-coding-string
254 (www-feature-format feature-name))
259 " <a href=\"%s?feature=%s&property=format&format=wiki-text&%s=%s\"
265 (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
268 (www-html-display-paragraph
269 (format "description : %s"
270 (or (char-feature-property feature-name 'description)
273 (www-html-display-paragraph
274 (format "description@%s : %s"
276 (or (char-feature-property
278 (intern (format "description@%s" lang)))
282 (defun www-batch-view ()
283 (setq terminal-coding-system 'binary)
285 (let* ((target (pop command-line-args-left))
286 (user (pop command-line-args-left))
287 (accept-language (pop command-line-args-left))
288 (mode (intern (pop command-line-args-left)))
293 (car (split-string accept-language ","))
297 (princ "Content-Type: text/html; charset=UTF-8
299 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
300 \"http://www.w3.org/TR/html4/loose.dtd\">
305 (when (string-match "^char=\\(&[^&;]+;\\)" target)
306 (setq ret (match-end 0))
309 (www-uri-encode-object
310 (www-uri-decode-object
311 'character (match-string 1 target)))
312 (substring target ret))))
314 (mapcar (lambda (cell)
315 (if (string-match "=" cell)
319 (substring cell 0 (match-beginning 0))
321 (substring cell (match-end 0)))
322 (list (decode-uri-string cell 'utf-8-mcs-er))))
323 (split-string target "&")))
324 (setq ret (car target))
325 (cond ((eq (car ret) 'char)
326 (www-display-object-desc
332 ((eq (car ret) 'feature)
333 (www-display-feature-desc
334 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
341 (www-display-object-desc
349 (princ (format "mode=%S\n" mode))
350 (princ (format "user=%s\n" user))
351 ;; (princ (format "local user=%s\n" (user-login-name)))
352 (princ (format "lang=%S\n" lang))
353 (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
355 ;; (princ xemacs-chise-version)
361 (princ (format "%S" err)))
364 (provide 'cwiki-view)