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-format)
90 (setq fn feature-name)
91 (while (and (setq parent (char-feature-name-parent fn))
93 (char-feature-property
94 parent 'value-format))))
97 (let ((type (www-feature-type feature-name)))
98 (cond ((eq type 'relation)
100 ((eq type 'structure)
101 'space-separated-ids)
105 (if (find-charset feature-name)
106 (if (and (= (charset-dimension feature-name) 2)
107 (= (charset-chars feature-name) 94))
109 " (" (decimal) ") <" (ku-ten) "> " (prev-char) (next-char))
110 '("0x" (HEX) " (" (decimal) ") " (prev-char) (next-char))))
113 (defun char-feature-name-at-domain (feature-name domain)
115 (let ((name (symbol-name feature-name)))
117 ((string-match "@[^*]+$" name)
118 (intern (format "%s/%s" name domain))
121 (intern (format "%s@%s" name domain))
125 (defun char-feature-name-parent (feature-name)
126 (let ((name (symbol-name feature-name)))
127 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
128 (intern (substring name 0 (car (last (match-data) 2)))))))
130 (defun char-feature-name-domain (feature-name)
131 (let ((name (symbol-name feature-name)))
132 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
133 (intern (substring name (1+ (match-beginning 0)))))))
135 (defun char-feature-name-sans-versions (feature)
136 (let ((feature-name (symbol-name feature)))
137 (if (string-match "[@/]\\$rev=latest$" feature-name)
138 (intern (substring feature-name 0 (match-beginning 0)))
141 (defun est-object-genre (object)
142 (if (characterp object)
144 (concord-object-genre object)))
146 (defun www-get-feature-value (object feature)
147 (let ((latest-feature (char-feature-name-at-domain feature '$rev=latest)))
150 (mount-char-attribute-table latest-feature)
151 (or (char-feature object latest-feature)
152 (char-feature object feature))
155 (or (condition-case nil
156 (concord-object-get object latest-feature)
159 (concord-object-get object feature)
163 (defun get-previous-code-point (ccs code)
164 (let ((chars (charset-chars ccs))
165 (dim (charset-dimension ccs))
167 mask byte-min byte-max
190 (setq bytes (make-vector dim 0))
192 (aset bytes i (logand (lsh code (* i -8)) mask))
195 (while (and (< i dim)
197 (aset bytes i (1- (aref bytes i)))
198 (< (aref bytes i) byte-min)))
199 (aset bytes i byte-max)
202 (setq dest (aref bytes 0)
205 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
209 (defun get-next-code-point (ccs code)
210 (let ((chars (charset-chars ccs))
211 (dim (charset-dimension ccs))
213 mask byte-min byte-max
236 (setq bytes (make-vector dim 0))
238 (aset bytes i (logand (lsh code (* i -8)) mask))
241 (while (and (< i dim)
243 (aset bytes i (1+ (aref bytes i)))
244 (> (aref bytes i) byte-max)))
245 (aset bytes i byte-min)
248 (setq dest (aref bytes 0)
251 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
255 (defun find-previous-defined-code-point (ccs code)
256 (let ((i (get-previous-code-point ccs code))
259 ((eq ccs '=jis-x0208)
260 (setq ccs '=jis-x0208@1990))
261 ((eq ccs '=jis-x0213-1)
262 (setq ccs '=jis-x0213-1@2004)))
265 (null (setq char (decode-char ccs i
266 (unless (eq ccs '=ucs)
268 (setq i (get-previous-code-point ccs i)))
271 (defun find-next-defined-code-point (ccs code)
272 (let ((i (get-next-code-point ccs code))
274 (setq max (+ code 1000))
276 ((eq ccs '=jis-x0208)
277 (setq ccs '=jis-x0208@1990))
278 ((eq ccs '=jis-x0213-1)
279 (setq ccs '=jis-x0213-1@2004)))
282 (null (setq char (decode-char ccs i
283 (unless (eq ccs '=ucs)
285 (setq i (get-next-code-point ccs i)))
289 ;;; @ URI representation
292 (defun www-uri-decode-feature-name (uri-feature)
294 (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er))
296 ((string-match "^from\\." uri-feature)
297 (intern (format "<-%s" (substring uri-feature (match-end 0))))
299 ((string-match "^to\\." uri-feature)
300 (intern (format "->%s" (substring uri-feature (match-end 0))))
302 ((string-match "^rep\\." uri-feature)
303 (intern (format "=%s" (substring uri-feature (match-end 0))))
305 ((string-match "^g\\." uri-feature)
306 (intern (format "=>>%s" (substring uri-feature (match-end 0))))
308 ((string-match "^gi\\." uri-feature)
309 (intern (format "=>>>%s" (substring uri-feature (match-end 0))))
311 ((string-match "^gi\\([0-9]+\\)\\." uri-feature)
312 (intern (format "=>>%s%s"
313 (make-string (string-to-int
314 (match-string 1 uri-feature))
316 (substring uri-feature (match-end 0))))
318 ((string-match "^o\\." uri-feature)
319 (intern (format "=+>%s" (substring uri-feature (match-end 0))))
321 ((string-match "^a\\." uri-feature)
322 (intern (format "=>%s" (substring uri-feature (match-end 0))))
324 ((string-match "^a\\([0-9]+\\)\\." uri-feature)
325 (intern (format "%s>%s"
326 (make-string (string-to-int
327 (match-string 1 uri-feature))
329 (substring uri-feature (match-end 0))))
331 ((and (setq feature (intern (format "=>%s" uri-feature)))
332 (find-charset feature))
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 (t (intern uri-feature)))))
345 (defun www-uri-encode-feature-name (feature-name)
346 (setq feature-name (symbol-name feature-name))
348 ((string-match "^=\\+>\\([^=>]+\\)" feature-name)
349 (concat "o." (substring feature-name (match-beginning 1)))
351 ((string-match "^=\\([^=>]+\\)" feature-name)
352 (concat "rep." (substring feature-name (match-beginning 1)))
354 ((string-match "^=>>\\([^=>]+\\)" feature-name)
355 (concat "g." (substring feature-name (match-beginning 1)))
357 ((string-match "^=>>>\\([^=>]+\\)" feature-name)
358 (concat "gi." (substring feature-name (match-beginning 1)))
360 ((string-match "^=>>\\(>+\\)" feature-name)
362 (length (match-string 1 feature-name))
363 (substring feature-name (match-end 1)))
365 ((string-match "^=>\\([^=>]+\\)" feature-name)
366 (concat "a." (substring feature-name (match-beginning 1)))
368 ((string-match "^\\(=+\\)>" feature-name)
370 (length (match-string 1 feature-name))
371 (substring feature-name (match-end 0)))
373 ((string-match "^->" feature-name)
374 (concat "to." (substring feature-name (match-end 0)))
376 ((string-match "^<-" feature-name)
377 (concat "from." (substring feature-name (match-end 0)))
381 (defun www-uri-make-feature-name-url (uri-genre uri-feature-name uri-object)
382 (format "%s?feature=%s&%s=%s"
383 chise-wiki-view-url uri-feature-name uri-genre uri-object))
385 (defun www-uri-decode-object (genre char-rep)
388 ((string-match "\\(%3A\\|:\\)" char-rep)
389 (setq ccs (substring char-rep 0 (match-beginning 0))
390 cpos (substring char-rep (match-end 0)))
391 (setq ccs (www-uri-decode-feature-name ccs))
393 ((string-match "^0x" cpos)
395 (string-to-number (substring cpos (match-end 0)) 16))
398 (setq cpos (car (read-from-string cpos)))
400 (if (and (eq genre 'character)
402 (decode-char ccs cpos)
403 (concord-decode-object ccs cpos genre))
406 (setq char-rep (decode-uri-string char-rep 'utf-8-mcs-er))
408 ((eq genre 'character)
409 (when (= (length char-rep) 1)
413 (concord-decode-object
414 '=id (www-uri-decode-feature-name char-rep) 'feature)
417 (concord-decode-object
418 '=id (car (read-from-string char-rep)) genre)
421 (defun www-uri-encode-object (object)
422 (if (characterp object)
423 (if (encode-char object '=ucs)
426 (format "%%%02X" byte))
427 (encode-coding-string (char-to-string object) 'utf-8-mcs-er)
429 (let ((ccs-list '(; =ucs
430 =cns11643-1 =cns11643-2 =cns11643-3
431 =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7
433 =jis-x0208 =jis-x0208@1990
438 =jis-x0213-1@2000 =jis-x0213-1@2004
439 =jis-x0208@1983 =jis-x0208@1978
440 =zinbun-oracle =>zinbun-oracle
444 =>>>jis-x0208 =>>>jis-x0213-1 =>>>jis-x0213-2
445 =>>jis-x0208 =>>jis-x0213-1 =>>jis-x0213-2
447 =+>jis-x0208 =+>jis-x0213-1 =+>jis-x0213-2
450 =>jis-x0208 =>jis-x0213-1
452 =>ucs@iso =>ucs@unicode
453 =>ucs@jis =>ucs@cns =>ucs@ks
454 =>>ucs@iso =>>ucs@unicode
455 =>>ucs@jis =>>ucs@cns =>>ucs@ks
456 =>>>ucs@iso =>>>ucs@unicode
457 =>>>ucs@jis =>>>ucs@cns =>>>ucs@ks
463 (setq ccs (pop ccs-list))
464 (not (setq ret (encode-char object ccs 'defined-only)))))
467 (www-uri-encode-feature-name ccs)
469 ((and (setq ccs (car (split-char object)))
470 (setq ret (encode-char object ccs)))
472 (www-uri-encode-feature-name ccs)
475 (format "system-char-id:0x%X"
476 (encode-char object 'system-char-id))
478 (format "rep.id:%s" (concord-object-id object))))
480 (defun est-format-object (object &optional readable)
481 (if (characterp object)
482 (char-to-string object)
483 (let ((ret (or (if readable
484 (or (concord-object-get object 'name)
485 (concord-object-get object '=name)
486 (concord-object-get object 'title)))
487 (concord-object-id object))))
490 (defun www-uri-make-object-url (object &optional uri-object)
493 (est-object-genre object)
495 (www-uri-encode-object object))))
498 ;;; @ Feature name presentation
501 (defun www-format-feature-name-default (feature-name)
505 (symbol-name feature-name)
509 (defun www-format-feature-name-as-metadata (feature-name &optional lang)
510 (let ((str (symbol-name feature-name))
513 ((string-match "\\*[^*]+$" str)
514 (setq base (substring str 0 (match-beginning 0))
515 meta (substring str (match-beginning 0)))
516 (concat (www-format-feature-name* (intern base) lang)
519 (www-format-feature-name-default feature-name)
522 (defun www-format-feature-name-as-rel-to (feature-name)
523 (concat "\u2192" (substring (symbol-name feature-name) 2)))
525 (defun www-format-feature-name-as-rel-from (feature-name)
526 (concat "\u2190" (substring (symbol-name feature-name) 2)))
528 (defun www-format-feature-name-as-CCS (feature-name)
531 (symbol-name feature-name)
533 (dest (upcase (pop rest))))
534 (when (string-match "^=+>*" dest)
535 (setq dest (concat (substring dest 0 (match-end 0))
537 (substring dest (match-end 0)))))
541 (setq dest (concat dest " " (upcase (pop rest)))))
542 (if (string-match "^[0-9]+$" (car rest))
543 (concat dest "-" (car rest))
544 (concat dest " " (upcase (car rest))))
548 (defun www-format-feature-name* (feature-name &optional lang)
549 (let (name fn parent ret)
552 (char-feature-property
554 (intern (format "name@%s" lang))))
555 (char-feature-property
556 feature-name 'name)))
557 ((and (setq name (symbol-name feature-name))
558 (string-match "\\*" name))
559 (www-format-feature-name-as-metadata feature-name lang))
561 (setq fn feature-name)
562 (while (and (setq parent (char-feature-name-parent fn))
565 (char-feature-property
567 (intern (format "name@%s" lang))))
568 (char-feature-property
573 (concat ret (substring (symbol-name feature-name)
574 (length (symbol-name parent)))))
575 ((find-charset feature-name)
576 (www-format-feature-name-as-CCS feature-name))
577 ((string-match "^\\(->\\)" name)
578 (www-format-feature-name-as-rel-to feature-name))
579 ((string-match "^\\(<-\\)" name)
580 (www-format-feature-name-as-rel-from feature-name))
582 (www-format-feature-name-default feature-name)
586 (defun www-format-feature-name (feature-name &optional lang)
587 (www-format-encode-string
588 (www-format-feature-name* feature-name lang)))
594 (defvar www-format-char-img-style "vertical-align:bottom;")
596 (defun www-format-encode-string (string &optional without-tags as-body)
599 (let (plane code start end char variants ret rret)
601 (goto-char (point-min))
602 (while (search-forward "&" nil t)
603 (replace-match "&" nil t)))
604 (goto-char (point-min))
605 (while (search-forward "<" nil t)
606 (replace-match "<" nil t))
607 (goto-char (point-min))
608 (while (search-forward ">" nil t)
609 (replace-match ">" nil t))
611 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
612 (let ((coded-charset-entity-reference-alist
615 '(=cns11643-1 "C1-" 4 X)
616 '(=cns11643-2 "C2-" 4 X)
617 '(=cns11643-3 "C3-" 4 X)
618 '(=cns11643-4 "C4-" 4 X)
619 '(=cns11643-5 "C5-" 4 X)
620 '(=cns11643-6 "C6-" 4 X)
621 '(=cns11643-7 "C7-" 4 X)
623 '(=gb12345 "G1-" 4 X)
624 '(=jis-x0208@1990 "J90-" 4 X)
625 '(=jis-x0212 "JSP-" 4 X)
627 '(=jis-x0208@1997 "J97-" 4 X)
628 '(=jis-x0208@1978 "J78-" 4 X)
629 '(=jis-x0208@1983 "J83-" 4 X)
630 '(=ruimoku-v6 "RUI6-" 4 X)
631 '(=zinbun-oracle "ZOB-" 4 d)
632 '(=jef-china3 "JC3-" 4 X)
633 '(=daikanwa "M-" 5 d)
634 coded-charset-entity-reference-alist)))
635 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
637 (goto-char (point-min))
638 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
639 (setq code (string-to-int (match-string 1)))
641 (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\"
644 chise-wiki-bitmap-glyphs-url
646 www-format-char-img-style)
649 (goto-char (point-min))
650 (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)
651 (setq plane (match-string 2)
652 code (string-to-int (match-string 3) 16))
654 (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\"
657 chise-wiki-bitmap-glyphs-url
660 (- (logand code 255) 32)
661 www-format-char-img-style)
664 (goto-char (point-min))
665 (while (re-search-forward "&G\\([01]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
666 (setq plane (string-to-int (match-string 1))
667 code (string-to-int (match-string 2) 16))
669 (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\"
672 chise-wiki-bitmap-glyphs-url
675 (- (logand code 255) 32)
676 www-format-char-img-style)
679 (goto-char (point-min))
680 (while (re-search-forward "&C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
681 (setq plane (string-to-int (match-string 1))
682 code (string-to-int (match-string 2) 16))
684 (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\"
687 chise-wiki-bitmap-glyphs-url
689 www-format-char-img-style)
692 (goto-char (point-min))
693 (while (re-search-forward "&JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
694 (setq code (string-to-int (match-string 1) 16))
696 (format "<img alt=\"JC3-%04X\" src=\"http://kanji.zinbun.kyoto-u.ac.jp/db/CHINA3/Gaiji/%04x.gif\">"
700 (goto-char (point-min))
701 (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
702 (setq code (string-to-int (match-string 2)))
704 (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\"
705 style=\"vertical-align:middle\">"
707 chise-wiki-bitmap-glyphs-url
709 www-format-char-img-style)
712 (goto-char (point-min))
713 (while (re-search-forward "&\\(G-\\|g2-\\)?GT-\\([0-9]+\\);" nil t)
714 (setq code (string-to-int (match-string 2)))
716 (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\"
719 chise-wiki-glyph-cgi-url
721 www-format-char-img-style)
724 (goto-char (point-min))
725 (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t)
726 (setq code (string-to-int (match-string 2)))
728 (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\"
731 chise-wiki-glyph-cgi-url
733 www-format-char-img-style)
736 (goto-char (point-min))
737 (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
738 (setq code (string-to-int (match-string 1) 16))
740 (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\"
743 chise-wiki-glyph-cgi-url
745 www-format-char-img-style)
748 (goto-char (point-min))
749 (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t)
750 (setq code (string-to-int (match-string 1) 16))
752 (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\"
755 chise-wiki-glyph-cgi-url
757 www-format-char-img-style)
760 (goto-char (point-min))
761 (while (re-search-forward "&RUI6-\\([0-9A-F]+\\);" nil t)
762 (setq code (string-to-int (match-string 1) 16))
764 (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\"
765 style=\"vertical-align:middle\">"
767 chise-wiki-glyph-cgi-url
769 www-format-char-img-style)
772 (goto-char (point-min))
773 (while (re-search-forward "&\\(A-\\)?\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
774 (setq code (string-to-int (match-string 3) 16))
776 (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\"
777 style=\"vertical-align:middle\">"
780 www-format-char-img-style)
783 (goto-char (point-min))
784 (while (re-search-forward "&MCS-\\([0-9A-F]+\\);" nil t)
785 (setq code (string-to-int (match-string 1) 16))
786 (setq start (match-beginning 0)
788 (setq char (decode-char 'system-char-id code))
791 (or (www-get-feature-value char '->subsumptive)
792 (www-get-feature-value char '->denotational)))
795 (setq ret (www-format-encode-string
796 (char-to-string (car variants))))
797 (string-match "&MCS-\\([0-9A-F]+\\);" ret))
798 (setq variants (cdr variants)))
800 (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret)
802 (delete-region start end)
805 ((setq ret (or (www-get-feature-value char 'ideographic-combination)
806 (www-get-feature-value char 'ideographic-structure)))
811 (if (characterp (setq rret (find-char ch)))
814 (www-format-encode-string
815 (char-to-string ch) without-tags)
816 (www-format-encode-string
817 (format "%S" ch) without-tags)))
821 (delete-region start end)
825 ;; (goto-char (point-min))
826 ;; (while (search-forward ">-" nil t)
827 ;; (replace-match "&GT-" t 'literal))
830 (defun www-html-display-text (text)
834 (goto-char (point-min))
835 (while (search-forward "<" nil t)
836 (replace-match "<" nil t))
837 (goto-char (point-min))
838 (while (search-forward ">" nil t)
839 (replace-match ">" nil t))
840 (goto-char (point-min))
841 (while (re-search-forward "\\[\\[\\([^]|[]+\\)|\\([^][]+\\)\\]\\]" nil t)
843 (format "<a href=\"%s\">%s</a>"
847 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
848 (goto-char (point-min))
849 (while (search-forward ">-" nil t)
850 (replace-match "&GT-" nil t))
853 (defun www-html-display-paragraph (text)
855 (www-html-display-text text)
862 (defvar coded-charset-GlyphWiki-id-alist
864 (=adobe-japan1-0 "aj1-" 5 d nil)
865 (=adobe-japan1-1 "aj1-" 5 d nil)
866 (=adobe-japan1-2 "aj1-" 5 d nil)
867 (=adobe-japan1-3 "aj1-" 5 d nil)
868 (=adobe-japan1-4 "aj1-" 5 d nil)
869 (=adobe-japan1-5 "aj1-" 5 d nil)
870 (=adobe-japan1-6 "aj1-" 5 d nil)
872 (=decomposition@hanyo-denshi)
873 (=hanyo-denshi/ks "koseki-" 6 d nil)
874 (=>>hanyo-denshi/ks "koseki-" 6 d nil)
875 (=ucs@jis "u" 4 x nil)
876 (=ucs@cns "u" 4 x "-t")
877 (=jis-x0212 "jsp-" 4 x nil)
878 (=jis-x0213-1@2000 "jx1-2000-" 4 x nil)
879 (=jis-x0213-1@2004 "jx1-2004-" 4 x nil)
880 (=jis-x0213-2 "jx2-" 4 x nil)
882 (=daikanwa "dkw-" 5 d nil)
883 (=>>daikanwa "dkw-" 5 d nil)
884 (=gt-k "gt-k" 5 d nil)
885 (=jef-china3 "jc3-" 4 x nil)
887 (=ks-x1001 "k0-" 4 x nil)
888 (=jis-x0208@1978/1pr "j78-" 4 x nil)
889 (=jis-x0208@1978/-4pr "j78-" 4 x nil)
890 (=jis-x0208@1978 "j78-" 4 x nil)
891 (=>>>jis-x0208@1978 "j78-" 4 x nil)
892 (=>>jis-x0208@1978 "j78-" 4 x nil)
893 (=+>jis-x0208@1978 "j78-" 4 x nil)
894 (=ucs@JP "u" 4 x nil)
895 (=ucs@gb "u" 4 x "-g")
896 (=ucs@ks "u" 4 x "-k")
897 (=ucs@iso "u" 4 x "-u")
898 (=ucs@unicode "u" 4 x "-us")
899 (=big5-cdp "cdp-" 4 x nil)
900 (=>>big5-cdp "cdp-" 4 x nil)
901 (=cns11643-1 "c1-" 4 x nil)
902 (=cns11643-2 "c2-" 4 x nil)
903 (=cns11643-3 "c3-" 4 x nil)
904 (=cns11643-4 "c4-" 4 x nil)
905 (=cns11643-5 "c5-" 4 x nil)
906 (=cns11643-6 "c6-" 4 x nil)
907 (=cns11643-7 "c7-" 4 x nil)
908 (=jis-x0208 "j90-" 4 x nil)
909 (=>>>jis-x0208 "j90-" 4 x nil)
910 (=>>jis-x0208 "j90-" 4 x nil)
911 (=+>jis-x0208 "j90-" 4 x nil)
912 (=jis-x0208@1990 "j90-" 4 x nil)
913 (=>>>jis-x0208@1990 "j90-" 4 x nil)
914 (=>>jis-x0208@1990 "j90-" 4 x nil)
915 (=+>jis-x0208@1990 "j90-" 4 x nil)
916 (=jis-x0208@1983 "j83-" 4 x nil)
917 (=>>>jis-x0208@1983 "j83-" 4 x nil)
918 (=>>jis-x0208@1983 "j83-" 4 x nil)
919 (=+>jis-x0208@1983 "j83-" 4 x nil)
920 (=cbeta "cb" 5 d nil)
923 (defun char-GlyphWiki-id (char)
924 (let ((rest coded-charset-GlyphWiki-id-alist)
927 (setq spec (pop rest))
928 (null (setq ret (char-feature char (car spec))))))
932 (mapconcat #'char-GlyphWiki-id ret "-"))
933 (and (memq (car spec) '(=ucs@unicode '=ucs@iso))
935 ((and (or (encode-char char '=jis-x0208@1990)
936 (encode-char char '=jis-x0212)
937 (encode-char char '=jis-x0213-1))
938 (setq code (encode-char char '=ucs@jis)))
939 (format "u%04x" code)
941 ((and (or (encode-char char '=gb2312)
942 (encode-char char '=gb12345))
943 (setq code (encode-char char '=ucs@gb)))
944 (format "u%04x-g" code)
946 ((and (or (encode-char char '=cns11643-1)
947 (encode-char char '=cns11643-2)
948 (encode-char char '=cns11643-3)
949 (encode-char char '=cns11643-4)
950 (encode-char char '=cns11643-5)
951 (encode-char char '=cns11643-6)
952 (encode-char char '=cns11643-7))
953 (setq code (encode-char char '=ucs@cns)))
954 (format "u%04x-t" code)
956 ((and (encode-char char '=ks-x1001)
957 (setq code (encode-char char '=ucs@ks)))
958 (format "u%04x-k" code)
960 (format (format "%s%%0%d%s%s"
964 (or (nth 4 spec) ""))
971 (provide 'cwiki-common)
973 ;;; cwiki-common.el ends here