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-char-display-feature-default (char feature-name &optional value
11 (setq value (char-feature char feature-name)))
13 (setq uri-char (char-to-string char)))
14 (www-html-display-paragraph
15 (format "[[%s|%?feature=%s&char=%s]] : %s [[[edit|%s?char=%s&feature=%s]]]"
16 (www-format-feature-name feature-name lang)
18 (www-uri-encode-feature-name feature-name)
20 (www-format-value value feature-name)
23 (www-uri-encode-feature-name feature-name)
26 (defun www-char-display-feature-as-ucs (char feature-name &optional value)
28 (setq value (char-feature char feature-name)))
29 (www-html-display-paragraph
30 (format "= [[U+%s|http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%s]] (%d)"
31 (www-format-value-as-HEX value)
32 (www-format-value-as-HEX value)
35 (defun www-display-char-desc (uri-char &optional lang level)
38 (let ((char (www-uri-decode-char uri-char)))
39 (when (characterp char)
44 <title>CHISE-wiki character: %s</title>
49 (princ (format "<h%d>%s</h%d>\n"
51 (www-format-encode-string (char-to-string char))
55 (dolist (cell (sort (char-attribute-alist char)
57 (char-attribute-name< (car a)(car b)))))
64 (or (char-feature-property (car cell) 'format)
65 '((name) " : " (value)))
66 char (car cell) lang uri-char))
68 (format " <a href=\"%s?char=%s&feature=%s\"
69 ><input type=\"submit\" value=\"note\" /></a>"
71 (www-format-encode-string uri-char)
72 (www-format-encode-string
73 (www-uri-encode-feature-name
74 (intern (format "%s*note" (car cell)))))))
85 (format "<a href=\"%s?char=%s\"
86 ><input type=\"submit\" value=\"add feature\" /></a>
89 (www-format-encode-string uri-char)))
96 (defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
97 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
98 (name@lang (intern (format "name@%s" lang))))
100 (encode-coding-string
102 <title>CHISE-wiki feature: %s</title>
108 (format "<h1>%s</h1>\n"
109 (www-format-encode-string
110 (symbol-name feature-name))))
111 (princ (format "<p>name : %s "
112 (or (www-format-feature-name feature-name) "")))
113 (www-html-display-text
114 (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
115 ;; (char-feature-property feature-name 'name)
117 uri-feature-name ; (www-uri-encode-feature-name feature-name)
123 (www-format-encode-string
126 (or (char-feature-property feature-name name@lang) ""))))
127 (www-html-display-text
128 (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
134 (www-html-display-paragraph
136 (or (www-feature-type feature-name)
137 ;; (char-feature-property feature-name 'type)
139 (www-html-display-paragraph
140 (format "description : %s"
141 (or (char-feature-property feature-name 'description)
144 (www-html-display-paragraph
145 (format "description@%s : %s"
147 (or (char-feature-property
149 (intern (format "description@%s" lang)))
153 (defun www-batch-view ()
154 (setq terminal-coding-system 'binary)
156 (let* ((target (pop command-line-args-left))
157 (user (pop command-line-args-left))
158 (accept-language (pop command-line-args-left))
163 (car (split-string accept-language ","))
167 (princ "Content-Type: text/html; charset=UTF-8
169 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
170 \"http://www.w3.org/TR/html4/loose.dtd\">
176 (mapcar (lambda (cell)
177 (if (string-match "=" cell)
181 (substring cell 0 (match-beginning 0))
183 (substring cell (match-end 0)))
184 (list (decode-uri-string cell 'utf-8-mcs-er))))
185 (split-string target "&")))
186 (setq ret (car target))
187 (cond ((eq (car ret) 'char)
188 (www-display-char-desc
189 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
192 ((eq (car ret) 'feature)
193 (www-display-feature-desc
194 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
195 (decode-uri-string (cdr (assq 'char target)))
200 (princ (format "user=%s\n" user))
201 (princ (format "local user=%s\n" (user-login-name)))
202 (princ (format "lang=%S\n" lang))
203 (princ emacs-version)
205 (princ xemacs-chise-version)
211 (princ (format "%S" err)))
214 (provide 'cwiki-view)