From e22f57c605ca3646ab7a7baae9613d507ad34134 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Fri, 2 Apr 2010 14:22:51 +0900 Subject: [PATCH] =?utf8?q?(www-uri-encode-char):=20Accept=20`=3D>zinbun-orac?= =?utf8?q?le'.=20(www-format-encode-string):=20-=20Display=20&A-ZOB-dddd;.=20?= =?utf8?q?-=20Support=20`ideographic-combination'=EF=BC=88=E5=90=88=E6=96=87?= =?utf8?q?=EF=BC=89=20and=20=20=20`ideographic-structure'.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- cwiki-common.el | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/cwiki-common.el b/cwiki-common.el index b0e1628..34e6380 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -212,7 +212,7 @@ =cbeta =jef-china3 =jis-x0213-1@2000 =jis-x0213-1@2004 =jis-x0208@1983 =jis-x0208@1978 - =zinbun-oracle + =zinbun-oracle =>zinbun-oracle =daikanwa =gt =gt-k =>>jis-x0208 =>>jis-x0213-1 @@ -478,7 +478,7 @@ (defun www-format-encode-string (string &optional without-tags) (with-temp-buffer (insert string) - (let (plane code start end char variants ret) + (let (plane code start end char variants ret rret) (goto-char (point-min)) (while (search-forward "<" nil t) (replace-match "<" nil t)) @@ -567,8 +567,8 @@ t 'literal)) (goto-char (point-min)) - (while (re-search-forward "&ZOB-\\([0-9]+\\);" nil t) - (setq code (string-to-int (match-string 1))) + (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t) + (setq code (string-to-int (match-string 2))) (replace-match (format "\"ZOB-%04d\"" code @@ -631,17 +631,41 @@ (setq start (match-beginning 0) end (match-end 0)) (setq char (decode-char 'system-char-id code)) - (setq variants (or (www-char-feature char '->subsumptive) - (www-char-feature char '->denotational))) - (while (and variants - (setq ret (www-format-encode-string - (char-to-string (car variants)))) - (string-match "&MCS-\\([0-9A-F]+\\);" ret)) - (setq variants (cdr variants))) - (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret) - (goto-char start) - (delete-region start end) - (insert ret))) + (cond + ((and (setq variants + (or (www-char-feature char '->subsumptive) + (www-char-feature char '->denotational))) + (progn + (while (and variants + (setq ret (www-format-encode-string + (char-to-string (car variants)))) + (string-match "&MCS-\\([0-9A-F]+\\);" ret)) + (setq variants (cdr variants))) + ret)) + (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret) + (goto-char start) + (delete-region start end) + (insert ret)) + ) + ((setq ret (or (www-char-feature char 'ideographic-combination) + (www-char-feature char 'ideographic-structure))) + (setq ret + (mapconcat + (lambda (ch) + (if (listp ch) + (if (characterp (setq rret (find-char ch))) + (setq ch rret))) + (if (characterp ch) + (www-format-encode-string + (char-to-string ch) without-tags) + (www-format-encode-string + (format "%S" ch) without-tags))) + ret "")) + (when ret + (goto-char start) + (delete-region start end) + (insert ret)) + ))) )) ;; (goto-char (point-min)) ;; (while (search-forward ">-" nil t) -- 1.7.10.4