X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=cwiki-common.el;h=2579d22089e70721649af2ae95cd60e14a00f22e;hb=b9262126891799cc1a7a65d89a40aea07336cc84;hp=ed51c579f0bc586c67f290f0a9ff357e3c5baed9;hpb=bc975ab6d895609519ec863ed5b21bf30a8e715e;p=chise%2Fest.git diff --git a/cwiki-common.el b/cwiki-common.el index ed51c57..2579d22 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -33,6 +33,10 @@ (mount-char-attribute-table '*instance@morpheme-entry/zh-classical) +(mount-char-attribute-table '->HNG) +(mount-char-attribute-table '<-HNG) + + (defvar est-hide-cgi-mode nil) (defvar est-view-url-prefix "..") (defvar chise-wiki-view-url "view.cgi") @@ -41,11 +45,56 @@ (defvar chise-wiki-bitmap-glyphs-url "http://www.chise.org/glyphs") +(defvar chise-wiki-hng-bitmap-glyphs-url + "http://hng.chise.org/glyphs/HNG") + (defvar chise-wiki-glyph-cgi-url "http://www.chise.org/chisewiki/glyph.cgi") (defvar chise-wiki-displayed-features nil) +(defvar est-coded-charset-priority-list + '(; =ucs + =cns11643-1 =cns11643-2 =cns11643-3 + =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7 + =gb2312 =gb12345 + =jis-x0208 =jis-x0208@1990 + =jis-x0213-2 + =jis-x0212 + =adobe-japan1 + =cbeta =jef-china3 + =jis-x0213-1@2000 =jis-x0213-1@2004 + =jis-x0208@1983 =jis-x0208@1978 + =zinbun-oracle =>zinbun-oracle + =daikanwa + =gt =gt-k + =>>>adobe-japan1 + =>>>jis-x0208 =>>>jis-x0213-1 =>>>jis-x0213-2 + =>>jis-x0208 =>>jis-x0213-1 =>>jis-x0213-2 + =>>adobe-japan1 + =+>jis-x0208 =+>jis-x0213-1 =+>jis-x0213-2 + =+>jis-x0208@1978 + =+>adobe-japan1 + =>jis-x0208 =>jis-x0213-1 + =>>gt + =>ucs@iso =>ucs@unicode + =>ucs@jis =>ucs@cns =>ucs@ks + =>>ucs@iso =>>ucs@unicode + =>>ucs@jis =>>ucs@cns =>>ucs@ks + =>>>ucs@iso =>>>ucs@unicode + =>>>ucs@jis =>>>ucs@cns =>>>ucs@ks + ===ucs@iso + =ruimoku-v6 + =big5 + =big5-cdp + =>cbeta + =mj + ==mj + ===mj + =ucs-itaiji-001 + =ucs-itaiji-002 + =ucs-itaiji-003)) + (defun decode-uri-string (string &optional coding-system) (if (> (length string) 0) (let ((i 0) @@ -84,7 +133,8 @@ )))) (defun www-feature-format (feature-name) - (or (char-feature-property feature-name 'format) + (or (char-feature-property feature-name 'presentation-format) + (char-feature-property feature-name 'format) (let (fn parent ret) (setq fn feature-name) (while (and (setq parent (char-feature-name-parent fn)) @@ -533,38 +583,7 @@ (format "%%%02X" byte)) (encode-coding-string (char-to-string object) 'utf-8-mcs-er) "") - (let ((ccs-list '(; =ucs - =cns11643-1 =cns11643-2 =cns11643-3 - =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7 - =gb2312 =gb12345 - =jis-x0208 =jis-x0208@1990 - =jis-x0213-2 - =jis-x0212 - =adobe-japan1 - =cbeta =jef-china3 - =jis-x0213-1@2000 =jis-x0213-1@2004 - =jis-x0208@1983 =jis-x0208@1978 - =zinbun-oracle =>zinbun-oracle - =daikanwa - =gt =gt-k - =>>>adobe-japan1 - =>>>jis-x0208 =>>>jis-x0213-1 =>>>jis-x0213-2 - =>>jis-x0208 =>>jis-x0213-1 =>>jis-x0213-2 - =>>adobe-japan1 - =+>jis-x0208 =+>jis-x0213-1 =+>jis-x0213-2 - =+>jis-x0208@1978 - =+>adobe-japan1 - =>jis-x0208 =>jis-x0213-1 - =>>gt - =>ucs@iso =>ucs@unicode - =>ucs@jis =>ucs@cns =>ucs@ks - =>>ucs@iso =>>ucs@unicode - =>>ucs@jis =>>ucs@cns =>>ucs@ks - =>>>ucs@iso =>>>ucs@unicode - =>>>ucs@jis =>>>ucs@cns =>>>ucs@ks - =ruimoku-v6 - =big5 - =big5-cdp)) + (let ((ccs-list est-coded-charset-priority-list) ccs ret) (while (and ccs-list (setq ccs (pop ccs-list)) @@ -719,7 +738,7 @@ (defun www-format-encode-string (string &optional without-tags as-body) (with-temp-buffer (insert string) - (let (plane code start end char variants ret rret) + (let (plane code subcode start end char variants ret rret) (when as-body (goto-char (point-min)) (while (search-forward "&" nil t) @@ -802,8 +821,8 @@ (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er) (goto-char (point-min)) - (while (re-search-forward "&CB\\([0-9]+\\);" nil t) - (setq code (string-to-int (match-string 1))) + (while (re-search-forward "&\\(A-\\)?CB\\([0-9]+\\);" nil t) + (setq code (string-to-int (match-string 2))) (replace-match (format "\"CB%05d\"" @@ -829,7 +848,20 @@ style=\"%s\">" t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&\\(o-\\|G-\\|g2-\\)?HD-\\(JA\\|JB\\|JC\\|JD\\|FT\\|IA\\|IB\\|HG\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?J0-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t) + (setq code (string-to-int (match-string 2) 16)) + (replace-match + (format "\"J0-%04X\"" + code + chise-wiki-bitmap-glyphs-url + (- (lsh code -8) 32) + (- (logand code 255) 32) + www-format-char-img-style) + t 'literal)) + + (goto-char (point-min)) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-\\(JA\\|JB\\|JC\\|JD\\|FT\\|IA\\|IB\\|HG\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t) (setq plane (match-string 2) code (string-to-int (match-string 3) 16)) (replace-match @@ -844,7 +876,7 @@ style=\"%s\">" t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&\\(o-\\|G-\\|g2-\\)?HD-\\(IP\\|JT\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-\\(IP\\|JT\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t) (setq plane (match-string 2) code (string-to-int (match-string 3) 16)) (replace-match @@ -857,7 +889,7 @@ style=\"%s\">" t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&\\(o-\\|G-\\|g2-\\)?HD-KS-\\([0-9]+\\);" nil t) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?HD-KS-\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 2))) (replace-match (format "\"HD-KS%06d\"" t 'literal)) (goto-char (point-min)) + (while (re-search-forward "&HNG\\([0-9]+\\)-\\([0-9][0-9][0-9][0-9]\\)\\([0-9]\\);" nil t) + (setq plane (match-string 1) + code (string-to-int (match-string 2)) + subcode (string-to-int (match-string 3))) + (setq subcode + (if (eq subcode 0) + "" + (char-to-string (decode-char 'ascii (+ 96 subcode))))) + (replace-match + (format + "\"HNG%s-%04d%s\"" + plane code subcode + chise-wiki-hng-bitmap-glyphs-url + plane code subcode + www-format-char-img-style) + t 'literal)) + + (goto-char (point-min)) (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?AJ1-\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 2))) (replace-match @@ -929,6 +980,42 @@ style=\"vertical-align:middle\">" t 'literal)) (goto-char (point-min)) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?MJ\\([0-9]+\\);" nil t) + (setq code (string-to-int (match-string 2))) + (replace-match + (format "\"MJ%06d\"" + code + code + www-format-char-img-style) + t 'literal)) + + (goto-char (point-min)) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\)?IU-\\([0-9A-F]+\\);" nil t) + (setq code (string-to-int (match-string 2) 16)) + (replace-match + (format "\"u%04x\"" + code + code + www-format-char-img-style) + t 'literal)) + + (goto-char (point-min)) + (while (re-search-forward "&\\(o-\\|G-\\|g2-\\|R-\\)?U-i\\([0-9]+\\)\\+\\([0-9A-F]+\\);" nil t) + (setq plane (string-to-int (match-string 2)) + code (string-to-int (match-string 3) 16)) + (replace-match + (format "\"u%04x-itaiji-%03d\"" + code + plane + code + plane + www-format-char-img-style) + t 'literal)) + + (goto-char (point-min)) (while (re-search-forward "&\\(G-\\|R-\\|g2-\\)?GT-\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 2))) (replace-match @@ -965,8 +1052,8 @@ style=\"%s\">" t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t) - (setq code (string-to-int (match-string 1) 16)) + (while (re-search-forward "&\\(G-\\|g2-\\|R-\\)?CDP-\\([0-9A-F]+\\);" nil t) + (setq code (string-to-int (match-string 2) 16)) (replace-match (format "\"CDP-%04X\"" @@ -1091,7 +1178,14 @@ style=\"vertical-align:middle\">" ;;; (defvar coded-charset-GlyphWiki-id-alist - '((=ucs "u" 4 x nil) + '((=ucs-var-001 "u" 4 x "-var-001") + (=ucs-var-002 "u" 4 x "-var-002") + (=ucs-var-003 "u" 4 x "-var-003") + (=ucs-itaiji-001 "u" 4 x "-itaiji-001") + (=ucs-itaiji-002 "u" 4 x "-itaiji-002") + (=ucs-itaiji-003 "u" 4 x "-itaiji-003") + (=ucs-itaiji-084 "u" 4 x "-itaiji-084") + (=ucs "u" 4 x nil) (=adobe-japan1-0 "aj1-" 5 d nil) (=adobe-japan1-1 "aj1-" 5 d nil) (=adobe-japan1-2 "aj1-" 5 d nil) @@ -1117,8 +1211,10 @@ style=\"vertical-align:middle\">" (=decomposition@hanyo-denshi) (=hanyo-denshi/ks "koseki-" 6 d nil) (=>>hanyo-denshi/ks "koseki-" 6 d nil) + (=koseki "koseki-" 6 d nil) (=ucs@jis "u" 4 x nil) (==ucs@jis "u" 4 x nil) + (==ucs@iso "u" 4 x nil) (===ucs@jis "u" 4 x nil) (=ucs@cns "u" 4 x "-t") (==ucs@cns "u" 4 x "-t") @@ -1170,6 +1266,8 @@ style=\"vertical-align:middle\">" (=+>jis-x0208@1983 "j83-" 4 x nil) (=cbeta "cb" 5 d nil) (=>>daikanwa "dkw-" 5 d nil) + (=big5-cdp-var-3 "cdp-" 4 x "-var-3") + (=big5-cdp-var-5 "cdp-" 4 x "-var-5") )) (defun char-GlyphWiki-id (char)