From: MORIOKA Tomohiko Date: Fri, 2 Apr 2010 05:22:51 +0000 (+0900) Subject: (www-uri-encode-char): Accept `=>zinbun-oracle'. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=e22f57c605ca3646ab7a7baae9613d507ad34134;p=chise%2Fest.git (www-uri-encode-char): Accept `=>zinbun-oracle'. (www-format-encode-string): - Display &A-ZOB-dddd;. - Support `ideographic-combination'(合文) and `ideographic-structure'. --- 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)