=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
(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))
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 "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\">"
code
(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)