(www-display-object-desc): Add styles for tooltips.
[chise/est.git] / cwiki-view.el
1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'cwiki-format)
3 (require 'char-db-json)
4
5 (defvar chise-wiki-view-url "view.cgi")
6 (defvar chise-wiki-edit-url "edit.cgi")
7 (defvar chise-wiki-add-url "add.cgi")
8
9 (defun www-edit-display-feature-input-box (char feature-name
10                                                 &optional format value)
11   (if (symbolp char)
12       (setq char (or (concord-decode-object '=id char 'feature)
13                      (concord-make-object 'feature char))))
14   (unless format
15     (setq format 'default))
16   (unless value
17     (setq value (www-get-feature-value char feature-name)))
18   (if (and (symbolp value)
19            (eq format 'wiki-text))
20       (setq value (list (list value))))
21   (princ
22    (format "<p><input type=\"text\" name=\"feature-name\"
23 size=\"32\" maxlength=\"256\" value=\"%s\">"
24            feature-name))
25   (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er))
26   (princ
27    (format "%s<input type=\"text\" name=\"%s\"
28 size=\"64\" maxlength=\"256\" value=\"%s\">
29 <input type=\"submit\" value=\"set\" /></p>
30 "
31            (if (or (eq format 'HEX)(eq format 'hex))
32                "0x"
33              "")
34            format
35            (mapconcat (lambda (c)
36                         (cond
37                          ;; ((eq c ?<) "&amp;lt;")
38                          ;; ((eq c ?>) "&amp;gt;")
39                          ((eq c ?\u0022) "&quot;")
40                          (t
41                           (char-to-string c))))
42                       (est-format-list value format nil nil " ")
43                       "")))
44   )
45
46 (defun www-display-object-desc (genre uri-object &optional uri-feature-name
47                                       lang level simple
48                                       uri-feature-name-to-edit editing-format)
49   (unless level
50     (setq level 0))
51   (let ((object (www-uri-decode-object genre uri-object))
52         (est-eval-list-feature-items-limit est-eval-list-feature-items-limit)
53         (est-view-url-prefix (if uri-feature-name
54                                  "../.."
55                                ".."))
56         (rdf-uri-object (if est-hide-cgi-mode
57                             (if (string-match "=" uri-object)
58                                 (concat
59                                  (est-uri-decode-feature-name-body
60                                   (substring uri-object 0 (match-beginning 0)))
61                                  ":"
62                                  (est-uri-decode-feature-name-body
63                                   (substring uri-object (match-end 0))))
64                               uri-object)))
65         feature-name-to-display feature-name-to-edit
66         base-name-to-edit metadata-name-to-edit
67         without-header
68         logical-feature chise-wiki-displayed-features
69         parents
70         GlyphWiki-id HNG-card ret object-spec)
71     (if (eq level 0)
72         (setq level 1
73               without-header nil)
74       (setq without-header t))
75     (when object
76       (when uri-feature-name-to-edit
77         (setq feature-name-to-edit
78               (www-uri-decode-feature-name uri-feature-name-to-edit))
79         (setq ret (symbol-name feature-name-to-edit))
80         (if (string-match "\\*" ret)
81             (setq base-name-to-edit (intern
82                                      (substring ret 0 (match-beginning 0)))
83                   metadata-name-to-edit (intern
84                                          (substring ret (match-end 0))))
85           (setq base-name-to-edit feature-name-to-edit))
86         (when (stringp editing-format)
87           (setq editing-format (intern editing-format))))
88       (when (and (eq genre 'character)
89                  (= (length uri-object) 1))
90         (setq uri-object (www-uri-encode-object object)))
91       (when (= level 1)
92         (princ
93          (encode-coding-string
94           (format "<head>
95 <style type=\"text/css\">
96 <!--
97 hr { color: green; }
98 .ids { vertical-align: middle; font-size: 40px; line-height: 100%%; }
99 a { text-decoration: none; }
100 .ids a { color: black; }
101 ul { margin: 0 0; color: black; }
102 li { margin: 0 0 0 2em; }
103 .feature-name { font-family: sans-serif; font-weight: bold; }
104 .feature-name a { color: black; }
105
106 .tooltip {
107     position: relative;
108     display: inline-block;
109     border-bottom: 1px dotted black;
110 }
111
112 .tooltip .tooltiptext {
113     visibility: hidden;
114     width: 120px;
115     top: 100%%;
116     left: 50%%;
117     margin-left: -60px;
118     background-color: black;
119     color: #fff;
120     text-align: center;
121     padding: 5px 0;
122     border-radius: 6px;
123  
124     position: absolute;
125     z-index: 1;
126 }
127
128 .list .tooltip:hover .tooltiptext {
129     visibility: visible;
130 }
131 -->
132 </style>
133
134 <title>EsT %s = %s</title>
135 </head>\n"
136                   genre
137                   (decode-uri-string uri-object 'utf-8-mcs-er))
138           'utf-8-mcs-er))
139         (princ "<body>\n"))
140       (when (eq genre 'character)
141         (dolist (feature (char-feature-property '$object 'additional-features))
142           (mount-char-attribute-table
143            (char-feature-name-at-domain feature '$rev=latest))))
144       (princ
145        (if simple
146            (format
147             (if est-hide-cgi-mode
148                 "<div style=\"text-align:right;\">
149 <a href=\"../../edit/view.cgi?%s=%s\">
150 <input type=\"submit\" value=\"Edit\" />
151 </a>\n"
152               "<div style=\"text-align:right;\">
153 <a href=\"edit/view.cgi?%s=%s\">
154 <input type=\"submit\" value=\"Edit\" />
155 </a>\n")
156             genre rdf-uri-object)
157          (format
158           "<div style=\"text-align:right;\">
159 <a href=\"../view/%s/%s\">
160 <input type=\"submit\" value=\"Simple\" />
161 </a>\n"
162           genre
163           (if (string-match ":" uri-object)
164               (concat
165                (est-uri-encode-feature-name-body
166                 (substring uri-object 0 (match-beginning 0)))
167                "="
168                (est-uri-encode-feature-name-body
169                 (substring uri-object (match-end 0))))))))
170       (princ
171        (format "<input type=\"submit\" value=\"New Account\" />
172 <a href=\"http://www.chise.org/est/rdf.cgi?%s=%s\">
173 <input type=\"submit\" value=\"RDF\" />
174 </a>%s
175 </div>
176 <hr />\n"
177                genre rdf-uri-object
178                (if (eq genre 'character)
179                    (format "
180 <a href=\"/est/view/%s/%s/data.json\">
181 <input type=\"submit\" value=\"JSON\" />
182 </a>\n"
183                            genre rdf-uri-object)
184                  "")))
185       (when (setq parents (www-get-feature-value object '<-denotational))
186         (princ (format "<p>%s %s</p>\n<hr>\n"
187                        (www-format-value-as-char-list parents)
188                        (www-format-feature-name '->denotational lang))))
189       (when (setq parents (www-get-feature-value object '<-subsumptive))
190         (princ (format "<p>%s %s</p>\n<hr>\n"
191                        (www-format-value-as-char-list parents)
192                        (www-format-feature-name '->subsumptive lang))))
193       (when (eq genre 'character)
194         (setq GlyphWiki-id (char-GlyphWiki-id object)))
195       (setq ret (www-format-encode-string
196                  (est-format-object object 'readable)))
197       (setq HNG-card
198             (if (string-match "<img alt=\"HNG\\([0-9]+\\)-\\([0-9]+\\)\"" ret)
199                 (format "HNG/%s/cards/%s.jpg"
200                         (match-string 1 ret)
201                         (match-string 2 ret))))
202       (princ (format "<h%d>%s%s</h%d>\n"
203                      level
204                      (if uri-feature-name
205                          (format "<a href=\"%s\">%s</a>"
206                                  ;; (if est-hide-cgi-mode
207                                  ;;     "<a href=\"../%s\">%s</a>"
208                                  ;;   "<a href=\"%s\">%s</a>")
209                                  (www-uri-make-object-url object uri-object)
210                                  ret)
211                        (if HNG-card
212                            (format
213                             "<a href=\"http://hng.chise.org/images/%s\">%s</a>"
214                             HNG-card ret)
215                          ret))
216                      (if GlyphWiki-id
217                          (format
218                           " <a href=\"http://glyphwiki.org/wiki/%s\"><img alt=\"%s\" src=\"http://glyphwiki.org/glyph/%s.50px.png\" /></a>"
219                           GlyphWiki-id
220                           GlyphWiki-id GlyphWiki-id)
221                        "")
222                      level))
223       (if (> level 1)
224           (princ "<ul>"))
225       (when feature-name-to-edit
226         (princ "<form action=\"set.cgi\" method=\"GET\">\n")
227         (princ
228          (encode-coding-string
229           (format "<p>(%s : <input type=\"text\" name=\"%s\"
230 size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
231 "
232                   genre genre
233                   (decode-uri-string uri-object 'utf-8-mcs-er))
234           'utf-8-mcs-er)))
235       (setq object-spec
236             (cond
237              (uri-feature-name
238               (setq feature-name-to-display
239                     (www-uri-decode-feature-name uri-feature-name))
240               (setq est-eval-list-feature-items-limit nil)
241               (list
242                (cons feature-name-to-display
243                      (if (eq genre 'character)
244                          (get-char-attribute object feature-name-to-display)
245                        (concord-object-get object feature-name-to-display)))))
246              (t
247               (if (eq genre 'character)
248                   (char-attribute-alist object)
249                 (concord-object-spec object)))))
250       (when feature-name-to-edit
251         (unless (assq base-name-to-edit object-spec)
252           (setq object-spec (cons (cons base-name-to-edit nil)
253                                   object-spec))))
254       (dolist (cell (sort object-spec
255                           (lambda (a b)
256                             (char-attribute-name<
257                              (char-feature-name-sans-versions (car a))
258                              (char-feature-name-sans-versions (car b))))))
259         (setq logical-feature (char-feature-name-sans-versions (car cell)))
260         (unless (memq logical-feature chise-wiki-displayed-features)
261           (push logical-feature chise-wiki-displayed-features)
262           (cond
263            ((and feature-name-to-edit
264                  (eq (car cell) feature-name-to-edit))
265             (www-edit-display-feature-input-box
266              object feature-name-to-edit editing-format)
267             )
268            (t
269             (princ
270              (if (= level 1)
271                  "<div class=\"feature\" style=\"line-height:150%\">\n"
272                "<li>\n"))
273             (princ
274              (www-format-eval-list
275               (www-feature-format logical-feature)
276               object
277               logical-feature ; (car cell)
278               lang uri-object
279               nil simple))
280             (unless simple
281               (princ
282                (format " <a href=\"%s?%s=%s&feature=%s&format=wiki-text\"
283 ><input type=\"submit\" value=\"note\" /></a>"
284                        chise-wiki-edit-url
285                        genre
286                        (www-format-encode-string uri-object)
287                        (www-format-encode-string
288                         (www-uri-encode-feature-name
289                          (intern (format "%s*note"
290                                          logical-feature ; (car cell)
291                                          )))))))
292             (when (and feature-name-to-edit
293                        (eq base-name-to-edit (car cell)) metadata-name-to-edit)
294               (princ "<ul>\n")
295               (princ "<li>")
296               (www-edit-display-feature-input-box
297                object feature-name-to-edit editing-format)
298               (princ "</li>")
299               (princ "</ul>"))
300             (princ
301              (if (= level 1)
302                  "</div>\n"
303                "<li>\n"))
304             ))
305           ))
306       (princ
307        (if (= level 1)
308            "<p>\n"
309          "<li>\n"))
310       (when feature-name-to-edit
311         (princ "</form>\n"))
312       (unless simple
313         (princ
314          (format "<a href=\"%s?%s=%s\"
315 ><input type=\"submit\" value=\"add feature\" /></a>
316 "
317                  chise-wiki-add-url
318                  genre
319                  (www-format-encode-string uri-object))))
320       (princ
321        (if (= level 1)
322            "<p>\n"
323          "<li>\n"))
324       (when (eq genre 'character)
325         (princ
326          "<form action=\"http://www.chise.org/ids-find\">\n")
327         (princ
328          (www-format-encode-string
329           (est-format-object object)
330           ;; (if (eq genre 'character)
331           ;;     (format "%c" object)
332           ;;   (format "%s" (concord-object-id object)))
333           ))
334         (princ
335          (format
336           " <input type=\"text\" name=\"components\"
337 size=\"30\" maxlength=\"30\" value=\"%s\" />"
338           (encode-coding-string
339            (est-format-object object)
340            ;; (if (eq genre 'character)
341            ;;     (char-to-string object)
342            ;;   (format "%s" (concord-object-id object)))
343            'utf-8-jp-er)))
344         (princ
345          (www-format-encode-string
346           "を\u542Bむ\u6F22\u5B57を\u63A2す"))
347         (princ " <input type=\"submit\" value=\"search\" />\n")
348         (princ "</form>\n")
349
350         (princ
351          "<form action=\"http://www.chise.org/hng-ids-find\">\n")
352         (princ
353          (www-format-encode-string
354           (est-format-object object)
355           ;; (if (eq genre 'character)
356           ;;     (format "%c" object)
357           ;;   (format "%s" (concord-object-id object)))
358           ))
359         (princ
360          (format
361           " <input type=\"text\" name=\"components\"
362 size=\"30\" maxlength=\"30\" value=\"%s\" />"
363           (encode-coding-string
364            (est-format-object object)
365            ;; (if (eq genre 'character)
366            ;;     (char-to-string object)
367            ;;   (format "%s" (concord-object-id object)))
368            'utf-8-jp-er)))
369         (princ
370          (www-format-encode-string
371           "を\u542Bむ HNG の\u6F22\u5B57を\u63A2す"))
372         (princ " <input type=\"submit\" value=\"search\" />\n")
373         (princ "</form>\n")
374         )
375       (princ
376        (if (= level 1)
377            "</p>\n"
378          "<li>\n"))
379       )))
380
381 (defun www-display-feature-desc (uri-feature-name genre uri-object
382                                                   &optional lang simple)
383   (let ((rdf-uri-object (if est-hide-cgi-mode
384                             (if (string-match "=" uri-object)
385                                 (concat
386                                  (est-uri-decode-feature-name-body
387                                   (substring uri-object 0 (match-beginning 0)))
388                                  ":"
389                                  (est-uri-decode-feature-name-body
390                                   (substring uri-object (match-end 0))))
391                               uri-object)))
392         (feature-name (www-uri-decode-feature-name uri-feature-name))
393         (name@lang (intern (format "name@%s" lang))))
394     (princ
395      (encode-coding-string
396       (format "<head>
397 <title>EsT feature: %s</title>
398 </head>\n"
399               feature-name)
400       'utf-8-mcs-er))
401     (princ "<body>\n")
402     (princ
403      (if simple
404          (format
405           (if est-hide-cgi-mode
406               "<div style=\"text-align:right;\">
407 <a href=\"../../../edit/view.cgi?feature=%s&%s=%s\">
408 <input type=\"submit\" value=\"Edit\" />
409 </a>
410 <input type=\"submit\" value=\"New Account\" />
411 </div>
412 <hr />\n"
413             "<div style=\"text-align:right;\">
414 <a href=\"edit/view.cgi?feature=%s&%s=%s\">
415 <input type=\"submit\" value=\"Edit\" />
416 </a>
417 <input type=\"submit\" value=\"New Account\" />
418 </div>
419 <hr />\n")
420           uri-feature-name genre rdf-uri-object)
421        (format
422         "<div style=\"text-align:right;\">
423 <a href=\"../view/feature/%s&%s/%s\">
424 <input type=\"submit\" value=\"Simple\" />
425 </a>
426 </div>
427 <hr />\n"
428         uri-feature-name genre uri-object)))
429     (princ
430      (format "<h1>%s</h1>\n"
431              (www-format-encode-string
432               (symbol-name feature-name))))
433     (princ (format "<p>name : %s "
434                    (or (www-format-feature-name feature-name) "")))
435     (unless simple
436       (princ
437        (format
438         " <a href=\"%s?feature=%s&property=name&format=string&%s=%s\">"
439         chise-wiki-edit-url
440         uri-feature-name
441         genre
442         uri-object))
443       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
444     (princ "</p>\n")
445     (when lang
446       (princ "<p>")
447       (princ
448        (www-format-encode-string
449         (format "%s : %s"
450                 name@lang
451                 (or (char-feature-property feature-name name@lang) ""))))
452       (unless simple
453         (princ
454          (format
455           " <a href=\"%s?feature=%s&property=%s&format=string&%s=%s\">"
456           chise-wiki-edit-url
457           uri-feature-name
458           name@lang
459           genre
460           uri-object))
461         (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
462       (princ "</p>\n"))
463     (www-html-display-paragraph
464      (format "type : %s"
465              (or (www-feature-type feature-name)
466                  ;; (char-feature-property feature-name 'type)
467                  'generic)))
468     (princ (format "<p>value-format : %s "
469                    (www-format-value
470                     nil 'value-format 
471                     (or (www-feature-value-format feature-name)
472                         'default)
473                     'default
474                     'without-tags)
475                    ))
476     (unless simple
477       (princ
478        (format
479         " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&%s=%s\"
480 >"
481         chise-wiki-edit-url
482         uri-feature-name
483         genre
484         uri-object))
485       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
486     (princ "</p>\n")
487
488     (princ (format "<p>value-presentation-format : %s "
489                    (www-format-value
490                     nil 'value-presentation-format 
491                     (or (www-feature-value-format feature-name)
492                         'default)
493                     'default
494                     'without-tags)
495                    ))
496     (unless simple
497       (princ
498        (format
499         " <a href=\"%s?feature=%s&property=value-presentation-format&format=wiki-text&%s=%s\"
500 >"
501         chise-wiki-edit-url
502         uri-feature-name
503         genre
504         uri-object))
505       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
506     (princ "</p>\n")
507
508     (princ "<p>format : ")
509     (www-html-display-text
510      (decode-coding-string
511       (www-xml-format-list
512        (www-feature-format feature-name))
513       'utf-8-mcs-er))
514     (unless simple
515       (princ
516        (format
517         " <a href=\"%s?feature=%s&property=format&format=wiki-text&%s=%s\"
518 >"
519         chise-wiki-edit-url
520         uri-feature-name
521         genre
522         uri-object))
523       (princ "<input type=\"submit\" value=\"edit\" /></a>\n"))
524     (princ "</p>\n")
525     
526     (www-html-display-paragraph
527      (format "description : %s"
528              (or (decode-coding-string
529                   (char-feature-property feature-name 'description)
530                   'utf-8-mcs-er)
531                  "")))
532     (when lang
533       (www-html-display-paragraph
534        (format "description@%s : %s"
535                lang
536                (or (char-feature-property
537                     feature-name
538                     (intern (format "description@%s" lang)))
539                    ""))))
540     ))
541   
542 (defun www-batch-view ()
543   (setq terminal-coding-system 'binary)
544   (condition-case err
545       (let* ((target (pop command-line-args-left))
546              (user (pop command-line-args-left))
547              (accept-language (pop command-line-args-left))
548              (mode (intern (pop command-line-args-left)))
549              (lang
550               (intern
551                (car (split-string
552                      (car (split-string
553                            (car (split-string accept-language ","))
554                            ";"))
555                      "-"))))
556              ret genre)
557         (princ "Content-Type: text/html; charset=UTF-8
558
559 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
560             \"http://www.w3.org/TR/html4/loose.dtd\">
561 <html lang=\"ja\">
562 ")
563         (cond
564          ((stringp target)
565           (when (string-match "^char=\\(&[^&;]+;\\)" target)
566             (setq ret (match-end 0))
567             (setq target
568                   (concat "char="
569                           (www-uri-encode-object
570                            (www-uri-decode-object
571                             'character (match-string 1 target)))
572                           (substring target ret))))
573           (setq target
574                 (mapcar (lambda (cell)
575                           (if (string-match "=" cell)
576                               (progn
577                                 (setq genre (substring cell 0 (match-beginning 0))
578                                       ret (substring cell (match-end 0)))
579                                 (cons
580                                  (intern
581                                   (decode-uri-string genre 'utf-8-mcs-er))
582                                  ret))
583                             (list (decode-uri-string cell 'utf-8-mcs-er))))
584                         (split-string target "&")))
585           (setq ret (car target))
586           (cond ((eq (car ret) 'char)
587                  (www-display-object-desc
588                   'character (cdr ret) (cdr (assq 'feature target))
589                   lang nil
590                   (eq mode 'simple))
591                  )
592                 ((eq (car ret) 'feature)
593                  (www-display-feature-desc
594                   (decode-uri-string (cdr ret) 'utf-8-mcs-er)
595                   (car (nth 1 target))
596                   (cdr (nth 1 target))
597                   lang
598                   (eq mode 'simple))
599                  )
600                 (t
601                  (www-display-object-desc
602                   (car ret) (cdr ret) (cdr (assq 'feature target))
603                   lang nil
604                   (eq mode 'simple))
605                  ))
606           ))
607         (princ "\n<hr>\n")
608         (princ (format "mode=%S\n" mode))
609         (princ (format "user=%s\n" user))
610         ;; (princ (format "local user=%s\n" (user-login-name)))
611         (princ (format "lang=%S\n" lang))
612         (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
613         ;; (princ " CHISE ")
614         ;; (princ xemacs-chise-version)
615         (princ "
616 </body>
617 </html>")
618         )
619     (error nil
620            (princ (format "%S" err)))
621     ))
622
623 (defun www-batch-view-smart ()
624   (setq debug-on-error t)
625   (setq terminal-coding-system 'binary)
626   (condition-case err
627       (let* ((est-hide-cgi-mode t)
628              (target (pop command-line-args-left))
629              (user (pop command-line-args-left))
630              (accept-language (pop command-line-args-left))
631              (mode (intern (pop command-line-args-left)))
632              (lang
633               (intern
634                (car (split-string
635                      (car (split-string
636                            (car (split-string accept-language ","))
637                            ";"))
638                      "-"))))
639              ret genre feature json obj)
640         (cond
641          ((stringp target)
642           (when (string-match "/data\\.json$" target)
643             (setq json t
644                   target (substring target 0 (match-beginning 0))))
645           (when (string-match "^char/\\(&[^&;]+;\\)" target)
646             (setq ret (match-end 0))
647             (setq target
648                   (concat "char/"
649                           (www-uri-encode-object
650                            (www-uri-decode-object
651                             'character (match-string 1 target)))
652                           (substring target ret))))
653           (setq target
654                 (mapcar
655                  (lambda (cell)
656                    (if (string-match "/" cell)
657                        (progn
658                          (setq genre (substring cell 0 (match-beginning 0))
659                                ret (substring cell (match-end 0)))
660                          (cons
661                           (intern (decode-uri-string genre 'utf-8-mcs-er))
662                           (if (string-match "/feature=" ret)
663                               (list (substring ret 0 (match-beginning 0))
664                                     (substring ret (match-end 0)))
665                             (list ret))))
666                      (list (decode-uri-string cell 'utf-8-mcs-er)))
667                    ;; (setq ret (split-string cell "/"))
668                    ;; (cons (intern
669                    ;;        (decode-uri-string (car ret) 'utf-8-mcs-er))
670                    ;;       (cdr ret))
671                    )
672                  (split-string target "&")))
673           (setq ret (car target))
674           (if json
675               (princ "Content-Type: application/json; charset=UTF-8
676
677 ")
678             (princ "Content-Type: text/html; charset=UTF-8
679
680 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
681             \"http://www.w3.org/TR/html4/loose.dtd\">
682 <html lang=\"ja\">
683 ")
684             )
685           ;; (princ (format "<p>%S, %S, %S</p>"
686           ;;                (car ret)(nth 1 ret)(nth 2 ret)))
687           ;; (princ (format "// %S %S\n" ret json))
688           (cond ((or (eq (car ret) 'char)
689                      (eq (car ret) 'character))
690                  (if (and json
691                           (setq obj (www-uri-decode-object
692                                      (car ret)(nth 1 ret)))
693                           (characterp obj))
694                      (with-temp-buffer
695                        ;; (princ (encode-coding-string
696                        ;;         (format "// %S\n" obj)
697                        ;;         char-db-file-coding-system))
698                        (char-db-json-char-data-with-variant obj 'printable)
699                        (encode-coding-region
700                         (point-min)(point-max)
701                         char-db-file-coding-system)
702                        (princ (buffer-string))
703                        )
704                    (www-display-object-desc
705                     'character (nth 1 ret) (nth 2 ret)
706                     lang nil
707                     (eq mode 'simple)))
708                  )
709                 ((eq (car ret) 'feature)
710                  (www-display-feature-desc
711                   (decode-uri-string (nth 1 ret) 'utf-8-mcs-er)
712                   (car (nth 1 target))
713                   (nth 1 (nth 1 target))
714                   lang
715                   (eq mode 'simple))
716                  )
717                 (t
718                  (www-display-object-desc
719                   (car ret) (nth 1 ret) (nth 2 ret)
720                   lang nil
721                   (eq mode 'simple))
722                  ))
723           ))
724         (unless json
725           (princ "\n<hr>\n")
726           (princ (format "mode=%S\n" mode))
727           (princ (format "user=%s\n" user))
728           ;; (princ (format "local user=%s\n" (user-login-name)))
729           (princ (format "lang=%S\n" lang))
730           (princ (encode-coding-string (emacs-version) 'utf-8-jp-er))
731           ;; (princ " CHISE ")
732           ;; (princ xemacs-chise-version)
733           (princ "
734 </body>
735 </html>")
736           )
737         )
738     (error nil
739            (princ (format "%S" err)))
740     ))
741
742 (provide 'cwiki-view)