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)
13 (when (characterp char)
14 (when (= (length uri-char) 1)
15 (setq uri-char (www-uri-encode-char char)))
20 <title>CHISE-wiki character: %s</title>
22 (decode-uri-string uri-char 'utf-8-mcs-er))
25 (princ (format "<h%d>%s</h%d>\n"
27 (www-format-encode-string (char-to-string char))
31 (dolist (feature (char-feature-property '$object 'additional-features))
32 (mount-char-attribute-table
33 (char-feature-name-at-domain feature '$rev=latest)))
34 (dolist (cell (sort (char-attribute-alist char)
36 (char-attribute-name< (car a)(car b)))))
37 (setq logical-feature (char-feature-name-sans-versions (car cell)))
38 (unless (memq logical-feature displayed-features)
39 (push logical-feature displayed-features)
46 (or (char-feature-property logical-feature ; (car cell)
48 '((name) " : " (value)))
50 logical-feature ; (car cell)
53 (format " <a href=\"%s?char=%s&feature=%s&format=wiki-text\"
54 ><input type=\"submit\" value=\"note\" /></a>"
56 (www-format-encode-string uri-char)
57 (www-format-encode-string
58 (www-uri-encode-feature-name
59 (intern (format "%s*note"
60 logical-feature ; (car cell)
72 (format "<a href=\"%s?char=%s\"
73 ><input type=\"submit\" value=\"add feature\" /></a>
76 (www-format-encode-string uri-char)))
83 (defun www-display-feature-desc (uri-feature-name uri-char &optional lang)
84 (let ((feature-name (www-uri-decode-feature-name uri-feature-name))
85 (name@lang (intern (format "name@%s" lang))))
89 <title>CHISE-wiki feature: %s</title>
95 (format "<h1>%s</h1>\n"
96 (www-format-encode-string
97 (symbol-name feature-name))))
98 (princ (format "<p>name : %s "
99 (or (www-format-feature-name feature-name) "")))
101 (format " <a href=\"%s?feature=%s&property=name&format=string&char=%s\"
102 ><input type=\"submit\" value=\"edit\" /></a>"
106 ;; (www-html-display-text
107 ;; (format "[[[edit|%s?feature=%s&property=name&char=%s]]]"
108 ;; ;; (char-feature-property feature-name 'name)
109 ;; chise-wiki-edit-url
110 ;; uri-feature-name ; (www-uri-encode-feature-name feature-name)
116 (www-format-encode-string
119 (or (char-feature-property feature-name name@lang) ""))))
121 (format " <a href=\"%s?feature=%s&property=%s&format=string&char=%s\"
122 ><input type=\"submit\" value=\"edit\" /></a>"
127 ;; (www-html-display-text
128 ;; (format " [[[edit|%s?feature=%s&property=%s&char=%s]]]"
129 ;; chise-wiki-edit-url
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 "value-format : %s"
142 (or (www-feature-value-format feature-name)
144 (www-html-display-paragraph
145 (format "format : %s"
147 (or (char-feature-property feature-name 'format)
148 '((name) " : " (value))))))
149 (www-html-display-paragraph
150 (format "description : %s"
151 (or (char-feature-property feature-name 'description)
154 (www-html-display-paragraph
155 (format "description@%s : %s"
157 (or (char-feature-property
159 (intern (format "description@%s" lang)))
163 (defun www-batch-view ()
164 (setq terminal-coding-system 'binary)
166 (let* ((target (pop command-line-args-left))
167 (user (pop command-line-args-left))
168 (accept-language (pop command-line-args-left))
173 (car (split-string accept-language ","))
177 (princ "Content-Type: text/html; charset=UTF-8
179 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
180 \"http://www.w3.org/TR/html4/loose.dtd\">
186 (mapcar (lambda (cell)
187 (if (string-match "=" cell)
191 (substring cell 0 (match-beginning 0))
193 (substring cell (match-end 0)))
194 (list (decode-uri-string cell 'utf-8-mcs-er))))
195 (split-string target "&")))
196 (setq ret (car target))
197 (cond ((eq (car ret) 'char)
198 (www-display-char-desc
199 (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
202 ((eq (car ret) 'feature)
203 (www-display-feature-desc
204 (decode-uri-string (cdr ret) 'utf-8-mcs-er)
205 (cdr (assq 'char target))
206 ;; (decode-uri-string (cdr (assq 'char target)))
211 (princ (format "user=%s\n" user))
212 (princ (format "local user=%s\n" (user-login-name)))
213 (princ (format "lang=%S\n" lang))
214 (princ emacs-version)
216 (princ xemacs-chise-version)
222 (princ (format "%S" err)))
225 (provide 'cwiki-view)