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/edit.cgi")
6 (defvar chise-wiki-add-url "edit/add.cgi")
8 (defun www-display-char-desc (uri-char &optional lang level)
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)))
30 (when (setq parents (www-char-feature char '<-denotational))
31 (princ (format "<p>%s %s</p>\n<hr>\n"
32 (www-format-value-as-char-list parents)
33 (www-format-feature-name '->denotational lang))))
34 (when (setq parents (www-char-feature char '<-subsumptive))
35 (princ (format "<p>%s %s</p>\n<hr>\n"
36 (www-format-value-as-char-list parents)
37 (www-format-feature-name '->subsumptive lang))))
38 (setq GlyphWiki-id (char-GlyphWiki-id char))
39 (princ (format "<h%d>%s%s</h%d>\n"
41 (www-format-encode-string (char-to-string char))
44 " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
46 GlyphWiki-id GlyphWiki-id)
51 (dolist (cell (sort (char-attribute-alist char)
53 (char-attribute-name< (car a)(car b)))))
54 (setq logical-feature (char-feature-name-sans-versions (car cell)))
55 (unless (memq logical-feature displayed-features)
56 (push logical-feature displayed-features)
63 (or (char-feature-property logical-feature ; (car cell)
65 '((name) " : " (value)))
67 logical-feature ; (car cell)
70 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
71 ><input type=\"submit\" value=\"note\" /></a>"
73 (www-format-encode-string uri-char)
74 (www-format-encode-string
75 (www-uri-encode-feature-name
76 (intern (format "%s*note"
77 logical-feature ; (car cell)
89 (format "<a href=\"%s?char=%s\"
90 ><input type=\"submit\" value=\"add feature\" /></a>
93 (www-format-encode-string uri-char)))
100 (defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
101 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
102 (name@lang (intern (format "name@%s" lang))))
104 (encode-coding-string
106 <title>CHISE-wiki feature: %s</title>
112 (format "<h1>%s</h1>\n"
113 (www-format-encode-string
114 (symbol-name feature-name))))
115 (princ (format "<p>name : %s "
116 (or (www-format-feature-name feature-name) "")))
118 (format " <a href=\"%s?feature=%s&property=name&format=string&char=%s\"
119 ><input type=\"submit\" value=\"edit\" /></a>"
123 ;; (www-html-display-text
124 ;; (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
125 ;; ;; (char-feature-property feature-name 'name)
126 ;; chise-wiki-edit-url
127 ;; uri-feature-name ; (www-uri-encode-feature-name feature-name)
133 (www-format-encode-string
136 (or (char-feature-property feature-name name@lang) ""))))
138 (format " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\"
139 ><input type=\"submit\" value=\"edit\" /></a>"
144 ;; (www-html-display-text
145 ;; (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
146 ;; chise-wiki-edit-url
151 (www-html-display-paragraph
153 (or (www-feature-type feature-name)
154 ;; (char-feature-property feature-name 'type)
156 (princ (format "<p>value-format : %s "
159 (or (www-feature-value-format feature-name)
163 ;; (www-html-display-paragraph
164 ;; (format "value-format : %s"
165 ;; (www-xml-format-list
166 ;; (or (www-feature-value-format feature-name)
170 " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
171 ><input type=\"submit\" value=\"edit\" /></a></p>"
176 (www-html-display-paragraph
177 (format "format : %s"
179 (or (char-feature-property feature-name 'format)
180 '((name) " : " (value))))))
181 (www-html-display-paragraph
182 (format "description : %s"
183 (or (char-feature-property feature-name 'description)
186 (www-html-display-paragraph
187 (format "description@%s : %s"
189 (or (char-feature-property
191 (intern (format "description@%s" lang)))
195 (defun www-batch-view ()
196 (setq terminal-coding-system 'binary)
198 (let* ((target (pop command-line-args-left))
199 (user (pop command-line-args-left))
200 (accept-language (pop command-line-args-left))
205 (car (split-string accept-language ","))
209 (princ "Content-Type: text/html; charset=UTF-8
211 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
212 \"http://www.w3.org/TR/html4/loose.dtd\">
218 (mapcar (lambda (cell)
219 (if (string-match "=" cell)
223 (substring cell 0 (match-beginning 0))
225 (substring cell (match-end 0)))
226 (list (decode-uri-string cell 'utf-8-mcs-er))))
227 (split-string target "&")))
228 (setq ret (car target))
229 (cond ((eq (car ret) 'char)
230 (www-display-char-desc
231 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
234 ((eq (car ret) 'feature)
235 (www-display-feature-desc
236 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
237 (cdr (assq 'char target))
238 ;; (decode-uri-string (cdr (assq 'char target)))
243 (princ (format "user=%s\n" user))
244 (princ (format "local user=%s\n" (user-login-name)))
245 (princ (format "lang=%S\n" lang))
246 (princ emacs-version)
248 (princ xemacs-chise-version)
254 (princ (format "%S" err)))
257 (provide 'cwiki-view)