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")
20 (mount-char-attribute-table 'instance@ruimoku/bibliography/title)
21 ;; (mount-char-attribute-table 'instance@ruimoku/bibliography/content*note)
24 (defvar chise-wiki-view-url "view.cgi")
25 (defvar chise-wiki-edit-url "edit.cgi")
27 (defvar chise-wiki-bitmap-glyphs-url
28 "http://www.chise.org/glyphs")
30 (defvar chise-wiki-glyph-cgi-url
31 "http://www.chise.org/chisewiki/glyph.cgi")
33 (defvar chise-wiki-displayed-features nil)
35 (defun decode-uri-string (string &optional coding-system)
36 (if (> (length string) 0)
40 (mapconcat (lambda (char)
43 (char-to-string char)))
45 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
46 (setq dest (concat dest
47 (substring string i (match-beginning 0))
50 (string-to-int (match-string 1 string) 16))))
53 (concat dest (substring string i))
56 (defun www-feature-type (feature-name)
57 (or (char-feature-property feature-name 'type)
58 (let ((str (symbol-name feature-name)))
60 ((string-match "\\*note\\(@[^*]+\\)?$" str)
62 ((string-match "\\*sources\\(@[^*]+\\)?$" str)
64 ((string-match "\\*" str)
66 ((string-match "^\\(->\\|<-\\)" str)
68 ((string-match "^ideographic-structure\\(@\\|$\\)" str)
72 (defun www-feature-format (feature-name)
73 (or (char-feature-property feature-name 'format)
75 (setq fn feature-name)
76 (while (and (setq parent (char-feature-name-parent fn))
78 (char-feature-property
82 '((name) " : " (value))))
84 (defun www-feature-value-format (feature-name)
85 (or (char-feature-property feature-name 'value-format)
87 (setq fn feature-name)
88 (while (and (setq parent (char-feature-name-parent fn))
90 (char-feature-property
91 parent 'value-format))))
94 (let ((type (www-feature-type feature-name)))
95 (cond ((eq type 'relation)
96 'space-separated-char-list)
102 (if (find-charset feature-name)
103 (if (and (= (charset-dimension feature-name) 2)
104 (= (charset-chars feature-name) 94))
106 " (" (decimal) ") <" (ku-ten) "> " (prev-char) (next-char))
107 '("0x" (HEX) " (" (decimal) ") " (prev-char) (next-char))))))
109 (defun char-feature-name-at-domain (feature-name domain)
111 (let ((name (symbol-name feature-name)))
113 ((string-match "@[^*]+$" name)
114 (intern (format "%s/%s" name domain))
117 (intern (format "%s@%s" name domain))
121 (defun char-feature-name-parent (feature-name)
122 (let ((name (symbol-name feature-name)))
123 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
124 (intern (substring name 0 (car (last (match-data) 2)))))))
126 (defun char-feature-name-domain (feature-name)
127 (let ((name (symbol-name feature-name)))
128 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
129 (intern (substring name (1+ (match-beginning 0)))))))
131 (defun char-feature-name-sans-versions (feature)
132 (let ((feature-name (symbol-name feature)))
133 (if (string-match "[@/]\\$rev=latest$" feature-name)
134 (intern (substring feature-name 0 (match-beginning 0)))
137 (defun est-object-genre (object)
138 (if (characterp object)
140 (concord-object-genre object)))
142 (defun www-get-feature-value (object feature)
143 (let ((latest-feature (char-feature-name-at-domain feature '$rev=latest)))
146 (mount-char-attribute-table latest-feature)
147 (or (char-feature object latest-feature)
148 (char-feature object feature))
151 (or (condition-case nil
152 (concord-object-get object latest-feature)
155 (concord-object-get object feature)
159 (defun get-previous-code-point (ccs code)
160 (let ((chars (charset-chars ccs))
161 (dim (charset-dimension ccs))
163 mask byte-min byte-max
186 (setq bytes (make-vector dim 0))
188 (aset bytes i (logand (lsh code (* i -8)) mask))
191 (while (and (< i dim)
193 (aset bytes i (1- (aref bytes i)))
194 (< (aref bytes i) byte-min)))
195 (aset bytes i byte-max)
198 (setq dest (aref bytes 0)
201 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
205 (defun get-next-code-point (ccs code)
206 (let ((chars (charset-chars ccs))
207 (dim (charset-dimension ccs))
209 mask byte-min byte-max
232 (setq bytes (make-vector dim 0))
234 (aset bytes i (logand (lsh code (* i -8)) mask))
237 (while (and (< i dim)
239 (aset bytes i (1+ (aref bytes i)))
240 (> (aref bytes i) byte-max)))
241 (aset bytes i byte-min)
244 (setq dest (aref bytes 0)
247 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
251 (defun find-previous-defined-code-point (ccs code)
252 (let ((i (get-previous-code-point ccs code))
255 ((eq ccs '=jis-x0208)
256 (setq ccs '=jis-x0208@1990))
257 ((eq ccs '=jis-x0213-1)
258 (setq ccs '=jis-x0213-1@2004)))
261 (null (setq char (decode-char ccs i
262 (unless (eq ccs '=ucs)
264 (setq i (get-previous-code-point ccs i)))
267 (defun find-next-defined-code-point (ccs code)
268 (let ((i (get-next-code-point ccs code))
270 (setq max (+ code 1000))
272 ((eq ccs '=jis-x0208)
273 (setq ccs '=jis-x0208@1990))
274 ((eq ccs '=jis-x0213-1)
275 (setq ccs '=jis-x0213-1@2004)))
278 (null (setq char (decode-char ccs i
279 (unless (eq ccs '=ucs)
281 (setq i (get-next-code-point ccs i)))
285 ;;; @ URI representation
288 (defun www-uri-decode-feature-name (uri-feature)
291 ((string-match "^from\\." uri-feature)
292 (intern (format "<-%s" (substring uri-feature (match-end 0))))
294 ((string-match "^to\\." uri-feature)
295 (intern (format "->%s" (substring uri-feature (match-end 0))))
297 ((string-match "^rep\\." uri-feature)
298 (intern (format "=%s" (substring uri-feature (match-end 0))))
300 ((string-match "^g\\." uri-feature)
301 (intern (format "=>>%s" (substring uri-feature (match-end 0))))
303 ((string-match "^gi\\." uri-feature)
304 (intern (format "=>>>%s" (substring uri-feature (match-end 0))))
306 ((string-match "^gi\\([0-9]+\\)\\." uri-feature)
307 (intern (format "=>>%s%s"
308 (make-string (string-to-int
309 (match-string 1 uri-feature))
311 (substring uri-feature (match-end 0))))
313 ((string-match "^o\\." uri-feature)
314 (intern (format "=+>%s" (substring uri-feature (match-end 0))))
316 ((string-match "^a\\." uri-feature)
317 (intern (format "=>%s" (substring uri-feature (match-end 0))))
319 ((string-match "^a\\([0-9]+\\)\\." uri-feature)
320 (intern (format "%s>%s"
321 (make-string (string-to-int
322 (match-string 1 uri-feature))
324 (substring uri-feature (match-end 0))))
326 ((and (setq feature (intern (format "=>%s" uri-feature)))
327 (find-charset feature))
329 ((and (setq feature (intern (format "=>>%s" uri-feature)))
330 (find-charset feature))
332 ((and (setq feature (intern (format "=>>>%s" uri-feature)))
333 (find-charset feature))
335 ((and (setq feature (intern (format "=%s" uri-feature)))
336 (find-charset feature))
338 (t (intern uri-feature)))))
340 (defun www-uri-encode-feature-name (feature-name)
341 (setq feature-name (symbol-name feature-name))
343 ((string-match "^=\\+>\\([^=>]+\\)" feature-name)
344 (concat "o." (substring feature-name (match-beginning 1)))
346 ((string-match "^=\\([^=>]+\\)" feature-name)
347 (concat "rep." (substring feature-name (match-beginning 1)))
349 ((string-match "^=>>\\([^=>]+\\)" feature-name)
350 (concat "g." (substring feature-name (match-beginning 1)))
352 ((string-match "^=>>>\\([^=>]+\\)" feature-name)
353 (concat "gi." (substring feature-name (match-beginning 1)))
355 ((string-match "^=>>\\(>+\\)" feature-name)
357 (length (match-string 1 feature-name))
358 (substring feature-name (match-end 1)))
360 ((string-match "^=>\\([^=>]+\\)" feature-name)
361 (concat "a." (substring feature-name (match-beginning 1)))
363 ((string-match "^\\(=+\\)>" feature-name)
365 (length (match-string 1 feature-name))
366 (substring feature-name (match-end 0)))
368 ((string-match "^->" feature-name)
369 (concat "to." (substring feature-name (match-end 0)))
371 ((string-match "^<-" feature-name)
372 (concat "from." (substring feature-name (match-end 0)))
376 (defun www-uri-make-feature-name-url (uri-genre uri-feature-name uri-object)
377 (format "%s?feature=%s&%s=%s"
378 chise-wiki-view-url uri-feature-name uri-genre uri-object))
380 (defun www-uri-decode-object (genre char-rep)
383 ((string-match "\\(%3A\\|:\\)" char-rep)
384 (setq ccs (substring char-rep 0 (match-beginning 0))
385 cpos (substring char-rep (match-end 0)))
386 (setq ccs (www-uri-decode-feature-name ccs))
388 ((string-match "^0x" cpos)
390 (string-to-number (substring cpos (match-end 0)) 16))
393 (setq cpos (car (read-from-string cpos)))
395 (if (and (eq genre 'character)
397 (decode-char ccs cpos)
398 (concord-decode-object ccs cpos genre))
401 (setq char-rep (decode-uri-string char-rep 'utf-8-mcs-er))
403 ((eq genre 'character)
404 (when (= (length char-rep) 1)
408 (concord-decode-object
409 '=id (www-uri-decode-feature-name char-rep) 'feature)
412 (concord-decode-object
413 '=id (car (read-from-string char-rep)) genre)
416 (defun www-uri-encode-object (object)
417 (if (characterp object)
418 (if (encode-char object '=ucs)
421 (format "%%%02X" byte))
422 (encode-coding-string (char-to-string object) 'utf-8-mcs-er)
424 (let ((ccs-list '(; =ucs
425 =cns11643-1 =cns11643-2 =cns11643-3
426 =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7
428 =jis-x0208 =jis-x0208@1990
431 =jis-x0213-1@2000 =jis-x0213-1@2004
432 =jis-x0208@1983 =jis-x0208@1978
433 =zinbun-oracle =>zinbun-oracle
436 =>>jis-x0208 =>>jis-x0213-1
438 =>jis-x0208 =>jis-x0213-1
440 =>ucs@iso =>ucs@unicode
441 =>ucs@jis =>ucs@cns =>ucs@ks
447 (setq ccs (pop ccs-list))
448 (not (setq ret (encode-char object ccs 'defined-only)))))
451 (www-uri-encode-feature-name ccs)
453 ((and (setq ccs (car (split-char object)))
454 (setq ret (encode-char object ccs)))
456 (www-uri-encode-feature-name ccs)
459 (format "system-char-id:0x%X"
460 (encode-char object 'system-char-id))
462 (format "rep.id:%s" (concord-object-id object))))
464 (defun est-format-object (object)
465 (if (characterp object)
466 (char-to-string object)
467 (format "%s" (concord-object-id object))))
469 (defun www-uri-make-object-url (object &optional uri-object)
472 (est-object-genre object)
474 (www-uri-encode-object object))))
477 ;;; @ Feature name presentation
480 (defun www-format-feature-name-default (feature-name)
484 (symbol-name feature-name)
488 (defun www-format-feature-name-as-metadata (feature-name &optional lang)
489 (let ((str (symbol-name feature-name))
492 ((string-match "\\*[^*]+$" str)
493 (setq base (substring str 0 (match-beginning 0))
494 meta (substring str (match-beginning 0)))
495 (concat (www-format-feature-name* (intern base) lang)
498 (www-format-feature-name-default feature-name)
501 (defun www-format-feature-name-as-rel-to (feature-name)
502 (concat "\u2192" (substring (symbol-name feature-name) 2)))
504 (defun www-format-feature-name-as-rel-from (feature-name)
505 (concat "\u2190" (substring (symbol-name feature-name) 2)))
507 (defun www-format-feature-name-as-CCS (feature-name)
510 (symbol-name feature-name)
512 (dest (upcase (pop rest))))
513 (when (string-match "^=+>*" dest)
514 (setq dest (concat (substring dest 0 (match-end 0))
516 (substring dest (match-end 0)))))
520 (setq dest (concat dest " " (upcase (pop rest)))))
521 (if (string-match "^[0-9]+$" (car rest))
522 (concat dest "-" (car rest))
523 (concat dest " " (upcase (car rest))))
527 (defun www-format-feature-name* (feature-name &optional lang)
528 (let (name fn parent ret)
531 (char-feature-property
533 (intern (format "name@%s" lang))))
534 (char-feature-property
535 feature-name 'name)))
536 ((and (setq name (symbol-name feature-name))
537 (string-match "\\*" name))
538 (www-format-feature-name-as-metadata feature-name lang))
540 (setq fn feature-name)
541 (while (and (setq parent (char-feature-name-parent fn))
544 (char-feature-property
546 (intern (format "name@%s" lang))))
547 (char-feature-property
552 (concat ret (substring (symbol-name feature-name)
553 (length (symbol-name parent)))))
554 ((find-charset feature-name)
555 (www-format-feature-name-as-CCS feature-name))
556 ((string-match "^\\(->\\)" name)
557 (www-format-feature-name-as-rel-to feature-name))
558 ((string-match "^\\(<-\\)" name)
559 (www-format-feature-name-as-rel-from feature-name))
561 (www-format-feature-name-default feature-name)
565 (defun www-format-feature-name (feature-name &optional lang)
566 (www-format-encode-string
567 (www-format-feature-name* feature-name lang)))
573 (defvar www-format-char-img-style "vertical-align:bottom;")
575 (defun www-format-encode-string (string &optional without-tags as-body)
578 (let (plane code start end char variants ret rret)
580 (goto-char (point-min))
581 (while (search-forward "&" nil t)
582 (replace-match "&" nil t)))
583 (goto-char (point-min))
584 (while (search-forward "<" nil t)
585 (replace-match "<" nil t))
586 (goto-char (point-min))
587 (while (search-forward ">" nil t)
588 (replace-match ">" nil t))
590 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
591 (let ((coded-charset-entity-reference-alist
594 '(=cns11643-1 "C1-" 4 X)
595 '(=cns11643-2 "C2-" 4 X)
596 '(=cns11643-3 "C3-" 4 X)
597 '(=cns11643-4 "C4-" 4 X)
598 '(=cns11643-5 "C5-" 4 X)
599 '(=cns11643-6 "C6-" 4 X)
600 '(=cns11643-7 "C7-" 4 X)
602 '(=gb12345 "G1-" 4 X)
603 '(=jis-x0208@1990 "J90-" 4 X)
604 '(=jis-x0212 "JSP-" 4 X)
606 '(=jis-x0208@1997 "J97-" 4 X)
607 '(=jis-x0208@1978 "J78-" 4 X)
608 '(=jis-x0208@1983 "J83-" 4 X)
609 '(=ruimoku-v6 "RUI6-" 4 X)
610 '(=zinbun-oracle "ZOB-" 4 d)
611 '(=jef-china3 "JC3-" 4 X)
612 '(=daikanwa "M-" 5 d)
613 coded-charset-entity-reference-alist)))
614 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
616 (goto-char (point-min))
617 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
618 (setq code (string-to-int (match-string 1)))
620 (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\"
623 chise-wiki-bitmap-glyphs-url
625 www-format-char-img-style)
628 (goto-char (point-min))
629 (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)
630 (setq plane (match-string 2)
631 code (string-to-int (match-string 3) 16))
633 (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\"
636 chise-wiki-bitmap-glyphs-url
639 (- (logand code 255) 32)
640 www-format-char-img-style)
643 (goto-char (point-min))
644 (while (re-search-forward "&G\\([01]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
645 (setq plane (string-to-int (match-string 1))
646 code (string-to-int (match-string 2) 16))
648 (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\"
651 chise-wiki-bitmap-glyphs-url
654 (- (logand code 255) 32)
655 www-format-char-img-style)
658 (goto-char (point-min))
659 (while (re-search-forward "&C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
660 (setq plane (string-to-int (match-string 1))
661 code (string-to-int (match-string 2) 16))
663 (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\"
666 chise-wiki-bitmap-glyphs-url
668 www-format-char-img-style)
671 (goto-char (point-min))
672 (while (re-search-forward "&JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
673 (setq code (string-to-int (match-string 1) 16))
675 (format "<img alt=\"JC3-%04X\" src=\"http://kanji.zinbun.kyoto-u.ac.jp/db/CHINA3/Gaiji/%04x.gif\">"
679 (goto-char (point-min))
680 (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
681 (setq code (string-to-int (match-string 2)))
683 (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\"
684 style=\"vertical-align:middle\">"
686 chise-wiki-bitmap-glyphs-url
688 www-format-char-img-style)
691 (goto-char (point-min))
692 (while (re-search-forward "&\\(G-\\|g2-\\)?GT-\\([0-9]+\\);" nil t)
693 (setq code (string-to-int (match-string 2)))
695 (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\"
698 chise-wiki-glyph-cgi-url
700 www-format-char-img-style)
703 (goto-char (point-min))
704 (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t)
705 (setq code (string-to-int (match-string 2)))
707 (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\"
710 chise-wiki-glyph-cgi-url
712 www-format-char-img-style)
715 (goto-char (point-min))
716 (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
717 (setq code (string-to-int (match-string 1) 16))
719 (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\"
722 chise-wiki-glyph-cgi-url
724 www-format-char-img-style)
727 (goto-char (point-min))
728 (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t)
729 (setq code (string-to-int (match-string 1) 16))
731 (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\"
734 chise-wiki-glyph-cgi-url
736 www-format-char-img-style)
739 (goto-char (point-min))
740 (while (re-search-forward "&RUI6-\\([0-9A-F]+\\);" nil t)
741 (setq code (string-to-int (match-string 1) 16))
743 (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\"
744 style=\"vertical-align:middle\">"
746 chise-wiki-glyph-cgi-url
748 www-format-char-img-style)
751 (goto-char (point-min))
752 (while (re-search-forward "&\\(A-\\)?\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
753 (setq code (string-to-int (match-string 3) 16))
755 (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\"
756 style=\"vertical-align:middle\">"
759 www-format-char-img-style)
762 (goto-char (point-min))
763 (while (re-search-forward "&MCS-\\([0-9A-F]+\\);" nil t)
764 (setq code (string-to-int (match-string 1) 16))
765 (setq start (match-beginning 0)
767 (setq char (decode-char 'system-char-id code))
770 (or (www-get-feature-value char '->subsumptive)
771 (www-get-feature-value char '->denotational)))
774 (setq ret (www-format-encode-string
775 (char-to-string (car variants))))
776 (string-match "&MCS-\\([0-9A-F]+\\);" ret))
777 (setq variants (cdr variants)))
779 (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret)
781 (delete-region start end)
784 ((setq ret (or (www-get-feature-value char 'ideographic-combination)
785 (www-get-feature-value char 'ideographic-structure)))
790 (if (characterp (setq rret (find-char ch)))
793 (www-format-encode-string
794 (char-to-string ch) without-tags)
795 (www-format-encode-string
796 (format "%S" ch) without-tags)))
800 (delete-region start end)
804 ;; (goto-char (point-min))
805 ;; (while (search-forward ">-" nil t)
806 ;; (replace-match "&GT-" t 'literal))
809 (defun www-html-display-text (text)
813 (goto-char (point-min))
814 (while (search-forward "<" nil t)
815 (replace-match "<" nil t))
816 (goto-char (point-min))
817 (while (search-forward ">" nil t)
818 (replace-match ">" nil t))
819 (goto-char (point-min))
820 (while (re-search-forward "\\[\\[\\([^]|[]+\\)|\\([^][]+\\)\\]\\]" nil t)
822 (format "<a href=\"%s\">%s</a>"
826 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
827 (goto-char (point-min))
828 (while (search-forward ">-" nil t)
829 (replace-match "&GT-" nil t))
832 (defun www-html-display-paragraph (text)
834 (www-html-display-text text)
841 (defvar coded-charset-GlyphWiki-id-alist
843 (=ucs@JP "u" 4 x nil)
844 (=ucs@jis "u" 4 x nil)
845 (=ucs@gb "u" 4 x "-g")
846 (=ucs@cns "u" 4 x "-t")
847 (=ucs@ks "u" 4 x "-k")
848 (=ucs@iso "u" 4 x "-u")
849 (=ucs@unicode "u" 4 x "-us")
850 (=adobe-japan1-6 "aj1-" 5 d nil)
852 (=big5-cdp "cdp-" 4 x nil)
853 (=cbeta "cb" 5 d nil)
854 (=jis-x0208@1978/1pr "j78-" 4 x nil)
855 (=jis-x0208@1978/-4pr "j78-" 4 x nil)
856 (=jis-x0208@1978 "j78-" 4 x nil)
857 (=jis-x0208@1983 "j83-" 4 x nil)
858 (=jis-x0208@1990 "j90-" 4 x nil)
859 (=jis-x0212 "jsp-" 4 x nil)
860 (=jis-x0213-1@2000 "jx1-2000-" 4 x nil)
861 (=jis-x0213-1@2004 "jx1-2004-" 4 x nil)
862 (=jis-x0213-2 "jx2-" 4 x nil)
863 (=cns11643-1 "c1-" 4 x nil)
864 (=cns11643-2 "c2-" 4 x nil)
865 (=cns11643-3 "c3-" 4 x nil)
866 (=cns11643-4 "c4-" 4 x nil)
867 (=cns11643-5 "c5-" 4 x nil)
868 (=cns11643-6 "c6-" 4 x nil)
869 (=cns11643-7 "c7-" 4 x nil)
870 (=daikanwa "dkw-" 5 d nil)
871 (=gt-k "gt-k" 5 d nil)
872 (=jef-china3 "jc3-" 4 x nil)
874 (=ks-x1001 "k0-" 4 x nil)
877 (defun char-GlyphWiki-id (char)
878 (let ((rest coded-charset-GlyphWiki-id-alist)
881 (setq spec (pop rest))
882 (null (setq ret (char-feature char (car spec))))))
885 (and (memq (car spec) '(=ucs@unicode '=ucs@iso))
887 ((and (or (encode-char char '=jis-x0208@1990)
888 (encode-char char '=jis-x0212)
889 (encode-char char '=jis-x0213-1))
890 (setq code (encode-char char '=ucs@jis)))
891 (format "u%04x" code)
893 ((and (or (encode-char char '=gb2312)
894 (encode-char char '=gb12345))
895 (setq code (encode-char char '=ucs@gb)))
896 (format "u%04x-g" code)
898 ((and (or (encode-char char '=cns11643-1)
899 (encode-char char '=cns11643-2)
900 (encode-char char '=cns11643-3)
901 (encode-char char '=cns11643-4)
902 (encode-char char '=cns11643-5)
903 (encode-char char '=cns11643-6)
904 (encode-char char '=cns11643-7))
905 (setq code (encode-char char '=ucs@cns)))
906 (format "u%04x-t" code)
908 ((and (encode-char char '=ks-x1001)
909 (setq code (encode-char char '=ucs@ks)))
910 (format "u%04x-k" code)
912 (format (format "%s%%0%d%s%s"
916 (or (nth 4 spec) ""))
923 (provide 'cwiki-common)
925 ;;; cwiki-common.el ends here