From 5ee884f3d4219a4a4963911766d6826d20b4fe93 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Wed, 21 Oct 2015 17:48:04 +0900 Subject: [PATCH] Mount `->HNG' and `<-HNG'. (chise-wiki-hng-bitmap-glyphs-url): New variable. (www-format-encode-string): - Format "&(o-|G-|g2-|R-)J0-hhhh;". - Format "R-HD-*;". - Format "&HNGdd-ddddd;". - Format "&(o-|G-|g2-|R-)MJ-dddddd;". - Format "&(G-|g2-|R-)CDP-hhhh;". --- cwiki-common.el | 62 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/cwiki-common.el b/cwiki-common.el index ed51c57..07ae80c 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,6 +45,9 @@ (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") @@ -719,7 +726,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) @@ -829,7 +836,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 +864,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 +877,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 +968,17 @@ 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 "&\\(G-\\|R-\\|g2-\\)?GT-\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 2))) (replace-match @@ -965,8 +1015,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\"" -- 1.7.10.4