1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'char-db-util)
4 (setq file-name-coding-system 'utf-8-mcs-er)
7 (concord-assign-genre 'creator@ruimoku "/usr/local/var/ruimoku/db")
8 (concord-assign-genre 'person-name@ruimoku "/usr/local/var/ruimoku/db")
10 (concord-assign-genre 'journal-volume@ruimoku "/usr/local/var/ruimoku/db")
11 (concord-assign-genre 'article@ruimoku "/usr/local/var/ruimoku/db")
12 (concord-assign-genre 'book@ruimoku "/usr/local/var/ruimoku/db")
14 (concord-assign-genre 'classification@ruimoku "/usr/local/var/ruimoku/db")
15 (concord-assign-genre 'region@ruimoku "/usr/local/var/ruimoku/db")
16 (concord-assign-genre 'era@ruimoku "/usr/local/var/ruimoku/db")
17 (concord-assign-genre 'period@ruimoku "/usr/local/var/ruimoku/db")
18 (concord-assign-genre 'journal@ruimoku "/usr/local/var/ruimoku/db")
19 (concord-assign-genre 'journal-name@ruimoku "/usr/local/var/ruimoku/db")
20 (concord-assign-genre 'publisher@ruimoku "/usr/local/var/ruimoku/db")
21 (concord-assign-genre 'publisher-name@ruimoku "/usr/local/var/ruimoku/db")
23 (mount-char-attribute-table '*instance@ruimoku/bibliography/title)
24 ;; (mount-char-attribute-table '*instance@ruimoku/bibliography/content*note)
27 (defvar chise-wiki-view-url "view.cgi")
28 (defvar chise-wiki-edit-url "edit.cgi")
30 (defvar chise-wiki-bitmap-glyphs-url
31 "http://www.chise.org/glyphs")
33 (defvar chise-wiki-glyph-cgi-url
34 "http://www.chise.org/chisewiki/glyph.cgi")
36 (defvar chise-wiki-displayed-features nil)
38 (defun decode-uri-string (string &optional coding-system)
39 (if (> (length string) 0)
43 (mapconcat (lambda (char)
46 (char-to-string char)))
48 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
49 (setq dest (concat dest
50 (substring string i (match-beginning 0))
53 (string-to-int (match-string 1 string) 16))))
56 (concat dest (substring string i))
59 (defun www-feature-type (feature-name)
60 (or (char-feature-property feature-name 'type)
61 (let ((str (symbol-name feature-name)))
63 ((string-match "\\*note\\(@[^*]+\\)?$" str)
65 ((string-match "\\*sources\\(@[^*]+\\)?$" str)
67 ((string-match "\\*" str)
69 ((string-match "^\\(->\\|<-\\)" str)
71 ((string-match "^ideographic-structure\\(@\\|$\\)" str)
75 (defun www-feature-format (feature-name)
76 (or (char-feature-property feature-name 'format)
78 (setq fn feature-name)
79 (while (and (setq parent (char-feature-name-parent fn))
81 (char-feature-property
85 '((name) " : " (value))))
87 (defun www-feature-value-format (feature-name)
88 (or (char-feature-property feature-name 'value-presentation-format)
89 (char-feature-property feature-name 'value-format)
91 (setq fn feature-name)
92 (while (and (setq parent (char-feature-name-parent fn))
94 (or (char-feature-property
95 parent 'value-presentation-format)
96 (char-feature-property
97 parent 'value-format)))))
100 (let ((type (www-feature-type feature-name)))
101 (cond ((eq type 'relation)
103 ((eq type 'structure)
104 'space-separated-ids)
108 (if (find-charset feature-name)
109 (if (and (= (charset-dimension feature-name) 2)
110 (= (charset-chars feature-name) 94))
112 " (" (decimal) ") <" (ku-ten) "> " (prev-char) (next-char))
113 '("0x" (HEX) " (" (decimal) ") " (prev-char) (next-char))))
116 (defun char-feature-name-at-domain (feature-name domain)
118 (let ((name (symbol-name feature-name)))
120 ((string-match "@[^*]+$" name)
121 (intern (format "%s/%s" name domain))
124 (intern (format "%s@%s" name domain))
128 (defun char-feature-name-parent (feature-name)
129 (let ((name (symbol-name feature-name)))
130 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
131 (intern (substring name 0 (car (last (match-data) 2)))))))
133 (defun char-feature-name-domain (feature-name)
134 (let ((name (symbol-name feature-name)))
135 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
136 (intern (substring name (1+ (match-beginning 0)))))))
138 (defun char-feature-name-sans-versions (feature)
139 (let ((feature-name (symbol-name feature)))
140 (if (string-match "[@/]\\$rev=latest$" feature-name)
141 (intern (substring feature-name 0 (match-beginning 0)))
144 (defun est-object-genre (object)
145 (if (characterp object)
147 (concord-object-genre object)))
149 (defun www-get-feature-value (object feature)
150 (let ((latest-feature (char-feature-name-at-domain feature '$rev=latest)))
153 (mount-char-attribute-table latest-feature)
154 (or (char-feature object latest-feature)
155 (char-feature object feature))
158 (or (condition-case nil
159 (concord-object-get object latest-feature)
162 (concord-object-get object feature)
166 (defun get-previous-code-point (ccs code)
167 (let ((chars (charset-chars ccs))
168 (dim (charset-dimension ccs))
170 mask byte-min byte-max
193 (setq bytes (make-vector dim 0))
195 (aset bytes i (logand (lsh code (* i -8)) mask))
198 (while (and (< i dim)
200 (aset bytes i (1- (aref bytes i)))
201 (< (aref bytes i) byte-min)))
202 (aset bytes i byte-max)
205 (setq dest (aref bytes 0)
208 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
212 (defun get-next-code-point (ccs code)
213 (let ((chars (charset-chars ccs))
214 (dim (charset-dimension ccs))
216 mask byte-min byte-max
239 (setq bytes (make-vector dim 0))
241 (aset bytes i (logand (lsh code (* i -8)) mask))
244 (while (and (< i dim)
246 (aset bytes i (1+ (aref bytes i)))
247 (> (aref bytes i) byte-max)))
248 (aset bytes i byte-min)
251 (setq dest (aref bytes 0)
254 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
258 (defun find-previous-defined-code-point (ccs code)
259 (let ((i (get-previous-code-point ccs code))
262 ((eq ccs '=jis-x0208)
263 (setq ccs '=jis-x0208@1990))
264 ((eq ccs '=jis-x0213-1)
265 (setq ccs '=jis-x0213-1@2004)))
268 (null (setq char (decode-char ccs i
269 (unless (eq ccs '=ucs)
271 (setq i (get-previous-code-point ccs i)))
274 (defun find-next-defined-code-point (ccs code)
275 (let ((i (get-next-code-point ccs code))
277 (setq max (+ code 1000))
279 ((eq ccs '=jis-x0208)
280 (setq ccs '=jis-x0208@1990))
281 ((eq ccs '=jis-x0213-1)
282 (setq ccs '=jis-x0213-1@2004)))
285 (null (setq char (decode-char ccs i
286 (unless (eq ccs '=ucs)
288 (setq i (get-next-code-point ccs i)))
292 ;;; @ URI representation
295 (defun www-uri-decode-feature-name (uri-feature)
297 (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er))
299 ((string-match "^from\\." uri-feature)
300 (intern (format "<-%s" (substring uri-feature (match-end 0))))
302 ((string-match "^to\\." uri-feature)
303 (intern (format "->%s" (substring uri-feature (match-end 0))))
305 ((string-match "^rep\\." uri-feature)
306 (intern (format "=%s" (substring uri-feature (match-end 0))))
308 ((string-match "^g\\." uri-feature)
309 (intern (format "=>>%s" (substring uri-feature (match-end 0))))
311 ((string-match "^gi\\." uri-feature)
312 (intern (format "=>>>%s" (substring uri-feature (match-end 0))))
314 ((string-match "^gi\\([0-9]+\\)\\." uri-feature)
315 (intern (format "=>>%s%s"
316 (make-string (string-to-int
317 (match-string 1 uri-feature))
319 (substring uri-feature (match-end 0))))
321 ((string-match "^o\\." uri-feature)
322 (intern (format "=+>%s" (substring uri-feature (match-end 0))))
324 ((string-match "^a\\." uri-feature)
325 (intern (format "=>%s" (substring uri-feature (match-end 0))))
327 ((string-match "^a\\([0-9]+\\)\\." uri-feature)
328 (intern (format "%s>%s"
329 (make-string (string-to-int
330 (match-string 1 uri-feature))
332 (substring uri-feature (match-end 0))))
334 ((and (setq feature (intern (format "=>%s" uri-feature)))
335 (find-charset feature))
337 ((and (setq feature (intern (format "=>>%s" uri-feature)))
338 (find-charset feature))
340 ((and (setq feature (intern (format "=>>>%s" uri-feature)))
341 (find-charset feature))
343 ((and (setq feature (intern (format "=%s" uri-feature)))
344 (find-charset feature))
346 (t (intern uri-feature)))))
348 (defun www-uri-encode-feature-name (feature-name)
349 (setq feature-name (symbol-name feature-name))
351 ((string-match "^=\\+>\\([^=>]+\\)" feature-name)
352 (concat "o." (substring feature-name (match-beginning 1)))
354 ((string-match "^=\\([^=>]+\\)" feature-name)
355 (concat "rep." (substring feature-name (match-beginning 1)))
357 ((string-match "^=>>\\([^=>]+\\)" feature-name)
358 (concat "g." (substring feature-name (match-beginning 1)))
360 ((string-match "^=>>>\\([^=>]+\\)" feature-name)
361 (concat "gi." (substring feature-name (match-beginning 1)))
363 ((string-match "^=>>\\(>+\\)" feature-name)
365 (length (match-string 1 feature-name))
366 (substring feature-name (match-end 1)))
368 ((string-match "^=>\\([^=>]+\\)" feature-name)
369 (concat "a." (substring feature-name (match-beginning 1)))
371 ((string-match "^\\(=+\\)>" feature-name)
373 (length (match-string 1 feature-name))
374 (substring feature-name (match-end 0)))
376 ((string-match "^->" feature-name)
377 (concat "to." (substring feature-name (match-end 0)))
379 ((string-match "^<-" feature-name)
380 (concat "from." (substring feature-name (match-end 0)))
384 (defun www-uri-make-feature-name-url (uri-genre uri-feature-name uri-object)
385 (format "%s?feature=%s&%s=%s"
386 chise-wiki-view-url uri-feature-name uri-genre uri-object))
388 (defun www-uri-decode-object (genre char-rep)
391 ((string-match "\\(%3A\\|:\\)" char-rep)
392 (setq ccs (substring char-rep 0 (match-beginning 0))
393 cpos (substring char-rep (match-end 0)))
394 (setq ccs (www-uri-decode-feature-name ccs))
396 ((string-match "^0x" cpos)
398 (string-to-number (substring cpos (match-end 0)) 16))
401 (setq cpos (car (read-from-string
403 cpos file-name-coding-system))))
405 (if (and (eq genre 'character)
407 (decode-char ccs cpos)
408 (concord-decode-object ccs cpos genre))
411 (setq char-rep (decode-uri-string char-rep 'utf-8-mcs-er))
413 ((eq genre 'character)
414 (when (= (length char-rep) 1)
418 (concord-decode-object
419 '=id (www-uri-decode-feature-name char-rep) 'feature)
422 (concord-decode-object
423 '=id (car (read-from-string char-rep)) genre)
426 (defun www-uri-encode-object (object)
427 (if (characterp object)
428 (if (encode-char object '=ucs)
431 (format "%%%02X" byte))
432 (encode-coding-string (char-to-string object) 'utf-8-mcs-er)
434 (let ((ccs-list '(; =ucs
435 =cns11643-1 =cns11643-2 =cns11643-3
436 =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7
438 =jis-x0208 =jis-x0208@1990
443 =jis-x0213-1@2000 =jis-x0213-1@2004
444 =jis-x0208@1983 =jis-x0208@1978
445 =zinbun-oracle =>zinbun-oracle
449 =>>>jis-x0208 =>>>jis-x0213-1 =>>>jis-x0213-2
450 =>>jis-x0208 =>>jis-x0213-1 =>>jis-x0213-2
452 =+>jis-x0208 =+>jis-x0213-1 =+>jis-x0213-2
455 =>jis-x0208 =>jis-x0213-1
457 =>ucs@iso =>ucs@unicode
458 =>ucs@jis =>ucs@cns =>ucs@ks
459 =>>ucs@iso =>>ucs@unicode
460 =>>ucs@jis =>>ucs@cns =>>ucs@ks
461 =>>>ucs@iso =>>>ucs@unicode
462 =>>>ucs@jis =>>>ucs@cns =>>>ucs@ks
468 (setq ccs (pop ccs-list))
469 (not (setq ret (encode-char object ccs 'defined-only)))))
472 (www-uri-encode-feature-name ccs)
474 ((and (setq ccs (car (split-char object)))
475 (setq ret (encode-char object ccs)))
477 (www-uri-encode-feature-name ccs)
480 (format "system-char-id:0x%X"
481 (encode-char object 'system-char-id))
483 (format "rep.id:%s" (concord-object-id object))))
485 (defun est-format-object (object &optional readable)
486 (if (characterp object)
487 (char-to-string object)
488 (let ((ret (or (if readable
489 (or (concord-object-get object 'name)
490 (concord-object-get object '=name)
491 (concord-object-get object 'title)))
492 (concord-object-id object))))
495 (defun www-uri-make-object-url (object &optional uri-object)
498 (est-object-genre object)
500 (www-uri-encode-object object))))
503 ;;; @ Feature name presentation
506 (defun www-format-feature-name-default (feature-name)
510 (symbol-name feature-name)
514 (defun www-format-feature-name-as-metadata (feature-name &optional lang)
515 (let ((str (symbol-name feature-name))
518 ((string-match "\\*[^*]+$" str)
519 (setq base (substring str 0 (match-beginning 0))
520 meta (substring str (match-beginning 0)))
521 (concat (www-format-feature-name* (intern base) lang)
524 (www-format-feature-name-default feature-name)
527 (defun www-format-feature-name-as-rel-to (feature-name)
528 (concat "\u2192" (substring (symbol-name feature-name) 2)))
530 (defun www-format-feature-name-as-rel-from (feature-name)
531 (concat "\u2190" (substring (symbol-name feature-name) 2)))
533 (defun www-format-feature-name-as-CCS (feature-name)
536 (symbol-name feature-name)
538 (dest (upcase (pop rest))))
539 (when (string-match "^=+>*" dest)
540 (setq dest (concat (substring dest 0 (match-end 0))
542 (substring dest (match-end 0)))))
546 (setq dest (concat dest " " (upcase (pop rest)))))
547 (if (string-match "^[0-9]+$" (car rest))
548 (concat dest "-" (car rest))
549 (concat dest " " (upcase (car rest))))
553 (defun www-format-feature-name* (feature-name &optional lang)
554 (let (name fn parent ret)
557 (char-feature-property
559 (intern (format "name@%s" lang))))
560 (char-feature-property
561 feature-name 'name)))
562 ((and (setq name (symbol-name feature-name))
563 (string-match "\\*" name))
564 (www-format-feature-name-as-metadata feature-name lang))
566 (setq fn feature-name)
567 (while (and (setq parent (char-feature-name-parent fn))
570 (char-feature-property
572 (intern (format "name@%s" lang))))
573 (char-feature-property
578 (concat ret (substring (symbol-name feature-name)
579 (length (symbol-name parent)))))
580 ((find-charset feature-name)
581 (www-format-feature-name-as-CCS feature-name))
582 ((string-match "^\\(->\\)" name)
583 (www-format-feature-name-as-rel-to feature-name))
584 ((string-match "^\\(<-\\)" name)
585 (www-format-feature-name-as-rel-from feature-name))
587 (www-format-feature-name-default feature-name)
591 (defun www-format-feature-name (feature-name &optional lang)
592 (www-format-encode-string
593 (www-format-feature-name* feature-name lang)))
599 (defvar www-format-char-img-style "vertical-align:bottom;")
601 (defun www-format-encode-string (string &optional without-tags as-body)
604 (let (plane code start end char variants ret rret)
606 (goto-char (point-min))
607 (while (search-forward "&" nil t)
608 (replace-match "&" nil t)))
609 (goto-char (point-min))
610 (while (search-forward "<" nil t)
611 (replace-match "<" nil t))
612 (goto-char (point-min))
613 (while (search-forward ">" nil t)
614 (replace-match ">" nil t))
616 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
617 (let ((coded-charset-entity-reference-alist
620 '(=cns11643-1 "C1-" 4 X)
621 '(=cns11643-2 "C2-" 4 X)
622 '(=cns11643-3 "C3-" 4 X)
623 '(=cns11643-4 "C4-" 4 X)
624 '(=cns11643-5 "C5-" 4 X)
625 '(=cns11643-6 "C6-" 4 X)
626 '(=cns11643-7 "C7-" 4 X)
628 '(=gb12345 "G1-" 4 X)
629 '(=jis-x0208@1990 "J90-" 4 X)
630 '(=jis-x0212 "JSP-" 4 X)
632 '(=jis-x0208@1997 "J97-" 4 X)
633 '(=jis-x0208@1978 "J78-" 4 X)
634 '(=jis-x0208@1983 "J83-" 4 X)
635 '(=ruimoku-v6 "RUI6-" 4 X)
636 '(=zinbun-oracle "ZOB-" 4 d)
637 '(=jef-china3 "JC3-" 4 X)
638 '(=daikanwa "M-" 5 d)
639 coded-charset-entity-reference-alist)))
640 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
642 (goto-char (point-min))
643 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
644 (setq code (string-to-int (match-string 1)))
646 (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\"
649 chise-wiki-bitmap-glyphs-url
651 www-format-char-img-style)
654 (goto-char (point-min))
655 (while (re-search-forward "&\\(o-\\)?J\\(78\\|83\\|90\\|97\\|SP\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
656 (setq plane (match-string 2)
657 code (string-to-int (match-string 3) 16))
659 (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\"
662 chise-wiki-bitmap-glyphs-url
665 (- (logand code 255) 32)
666 www-format-char-img-style)
669 (goto-char (point-min))
670 (while (re-search-forward "&G\\([01]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
671 (setq plane (string-to-int (match-string 1))
672 code (string-to-int (match-string 2) 16))
674 (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\"
677 chise-wiki-bitmap-glyphs-url
680 (- (logand code 255) 32)
681 www-format-char-img-style)
684 (goto-char (point-min))
685 (while (re-search-forward "&C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
686 (setq plane (string-to-int (match-string 1))
687 code (string-to-int (match-string 2) 16))
689 (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\"
692 chise-wiki-bitmap-glyphs-url
694 www-format-char-img-style)
697 (goto-char (point-min))
698 (while (re-search-forward "&JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
699 (setq code (string-to-int (match-string 1) 16))
701 (format "<img alt=\"JC3-%04X\" src=\"http://kanji.zinbun.kyoto-u.ac.jp/db/CHINA3/Gaiji/%04x.gif\">"
705 (goto-char (point-min))
706 (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
707 (setq code (string-to-int (match-string 2)))
709 (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\"
710 style=\"vertical-align:middle\">"
712 chise-wiki-bitmap-glyphs-url
714 www-format-char-img-style)
717 (goto-char (point-min))
718 (while (re-search-forward "&\\(G-\\|g2-\\)?GT-\\([0-9]+\\);" nil t)
719 (setq code (string-to-int (match-string 2)))
721 (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\"
724 chise-wiki-glyph-cgi-url
726 www-format-char-img-style)
729 (goto-char (point-min))
730 (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t)
731 (setq code (string-to-int (match-string 2)))
733 (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\"
736 chise-wiki-glyph-cgi-url
738 www-format-char-img-style)
741 (goto-char (point-min))
742 (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
743 (setq code (string-to-int (match-string 1) 16))
745 (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\"
748 chise-wiki-glyph-cgi-url
750 www-format-char-img-style)
753 (goto-char (point-min))
754 (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t)
755 (setq code (string-to-int (match-string 1) 16))
757 (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\"
760 chise-wiki-glyph-cgi-url
762 www-format-char-img-style)
765 (goto-char (point-min))
766 (while (re-search-forward "&RUI6-\\([0-9A-F]+\\);" nil t)
767 (setq code (string-to-int (match-string 1) 16))
769 (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\"
770 style=\"vertical-align:middle\">"
772 chise-wiki-glyph-cgi-url
774 www-format-char-img-style)
777 (goto-char (point-min))
778 (while (re-search-forward "&\\(A-\\)?\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
779 (setq code (string-to-int (match-string 3) 16))
781 (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\"
782 style=\"vertical-align:middle\">"
785 www-format-char-img-style)
788 (goto-char (point-min))
789 (while (re-search-forward "&MCS-\\([0-9A-F]+\\);" nil t)
790 (setq code (string-to-int (match-string 1) 16))
791 (setq start (match-beginning 0)
793 (setq char (decode-char 'system-char-id code))
796 (or (www-get-feature-value char '->subsumptive)
797 (www-get-feature-value char '->denotational)))
800 (setq ret (www-format-encode-string
801 (char-to-string (car variants))))
802 (string-match "&MCS-\\([0-9A-F]+\\);" ret))
803 (setq variants (cdr variants)))
805 (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret)
807 (delete-region start end)
810 ((setq ret (or (www-get-feature-value char 'ideographic-combination)
811 (www-get-feature-value char 'ideographic-structure)))
816 (if (characterp (setq rret (find-char ch)))
819 (www-format-encode-string
820 (char-to-string ch) without-tags)
821 (www-format-encode-string
822 (format "%S" ch) without-tags)))
826 (delete-region start end)
830 ;; (goto-char (point-min))
831 ;; (while (search-forward ">-" nil t)
832 ;; (replace-match "&GT-" t 'literal))
835 (defun www-html-display-text (text)
839 (goto-char (point-min))
840 (while (search-forward "<" nil t)
841 (replace-match "<" nil t))
842 (goto-char (point-min))
843 (while (search-forward ">" nil t)
844 (replace-match ">" nil t))
845 (goto-char (point-min))
846 (while (re-search-forward "\\[\\[\\([^]|[]+\\)|\\([^][]+\\)\\]\\]" nil t)
848 (format "<a href=\"%s\">%s</a>"
852 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
853 (goto-char (point-min))
854 (while (search-forward ">-" nil t)
855 (replace-match "&GT-" nil t))
858 (defun www-html-display-paragraph (text)
860 (www-html-display-text text)
867 (defvar coded-charset-GlyphWiki-id-alist
869 (=adobe-japan1-0 "aj1-" 5 d nil)
870 (=adobe-japan1-1 "aj1-" 5 d nil)
871 (=adobe-japan1-2 "aj1-" 5 d nil)
872 (=adobe-japan1-3 "aj1-" 5 d nil)
873 (=adobe-japan1-4 "aj1-" 5 d nil)
874 (=adobe-japan1-5 "aj1-" 5 d nil)
875 (=adobe-japan1-6 "aj1-" 5 d nil)
877 (=decomposition@hanyo-denshi)
878 (=hanyo-denshi/ks "koseki-" 6 d nil)
879 (=>>hanyo-denshi/ks "koseki-" 6 d nil)
880 (=ucs@jis "u" 4 x nil)
881 (=ucs@cns "u" 4 x "-t")
882 (=jis-x0212 "jsp-" 4 x nil)
883 (=jis-x0213-1@2000 "jx1-2000-" 4 x nil)
884 (=jis-x0213-1@2004 "jx1-2004-" 4 x nil)
885 (=jis-x0213-2 "jx2-" 4 x nil)
887 (=daikanwa "dkw-" 5 d nil)
888 (=>>daikanwa "dkw-" 5 d nil)
889 (=gt-k "gt-k" 5 d nil)
890 (=jef-china3 "jc3-" 4 x nil)
892 (=ks-x1001 "k0-" 4 x nil)
893 (=jis-x0208@1978/1pr "j78-" 4 x nil)
894 (=jis-x0208@1978/-4pr "j78-" 4 x nil)
895 (=jis-x0208@1978 "j78-" 4 x nil)
896 (=>>>jis-x0208@1978 "j78-" 4 x nil)
897 (=>>jis-x0208@1978 "j78-" 4 x nil)
898 (=+>jis-x0208@1978 "j78-" 4 x nil)
899 (=ucs@JP "u" 4 x nil)
900 (=ucs@gb "u" 4 x "-g")
901 (=ucs@ks "u" 4 x "-k")
902 (=ucs@iso "u" 4 x "-u")
903 (=ucs@unicode "u" 4 x "-us")
904 (=big5-cdp "cdp-" 4 x nil)
905 (=>>big5-cdp "cdp-" 4 x nil)
906 (=cns11643-1 "c1-" 4 x nil)
907 (=cns11643-2 "c2-" 4 x nil)
908 (=cns11643-3 "c3-" 4 x nil)
909 (=cns11643-4 "c4-" 4 x nil)
910 (=cns11643-5 "c5-" 4 x nil)
911 (=cns11643-6 "c6-" 4 x nil)
912 (=cns11643-7 "c7-" 4 x nil)
913 (=jis-x0208 "j90-" 4 x nil)
914 (=>>>jis-x0208 "j90-" 4 x nil)
915 (=>>jis-x0208 "j90-" 4 x nil)
916 (=+>jis-x0208 "j90-" 4 x nil)
917 (=jis-x0208@1990 "j90-" 4 x nil)
918 (=>>>jis-x0208@1990 "j90-" 4 x nil)
919 (=>>jis-x0208@1990 "j90-" 4 x nil)
920 (=+>jis-x0208@1990 "j90-" 4 x nil)
921 (=jis-x0208@1983 "j83-" 4 x nil)
922 (=>>>jis-x0208@1983 "j83-" 4 x nil)
923 (=>>jis-x0208@1983 "j83-" 4 x nil)
924 (=+>jis-x0208@1983 "j83-" 4 x nil)
925 (=cbeta "cb" 5 d nil)
928 (defun char-GlyphWiki-id (char)
929 (let ((rest coded-charset-GlyphWiki-id-alist)
932 (setq spec (pop rest))
933 (null (setq ret (char-feature char (car spec))))))
937 (mapconcat #'char-GlyphWiki-id ret "-"))
938 (and (memq (car spec) '(=ucs@unicode '=ucs@iso))
940 ((and (or (encode-char char '=jis-x0208@1990)
941 (encode-char char '=jis-x0212)
942 (encode-char char '=jis-x0213-1))
943 (setq code (encode-char char '=ucs@jis)))
944 (format "u%04x" code)
946 ((and (or (encode-char char '=gb2312)
947 (encode-char char '=gb12345))
948 (setq code (encode-char char '=ucs@gb)))
949 (format "u%04x-g" code)
951 ((and (or (encode-char char '=cns11643-1)
952 (encode-char char '=cns11643-2)
953 (encode-char char '=cns11643-3)
954 (encode-char char '=cns11643-4)
955 (encode-char char '=cns11643-5)
956 (encode-char char '=cns11643-6)
957 (encode-char char '=cns11643-7))
958 (setq code (encode-char char '=ucs@cns)))
959 (format "u%04x-t" code)
961 ((and (encode-char char '=ks-x1001)
962 (setq code (encode-char char '=ucs@ks)))
963 (format "u%04x-k" code)
965 (format (format "%s%%0%d%s%s"
969 (or (nth 4 spec) ""))
976 (provide 'cwiki-common)
978 ;;; cwiki-common.el ends here