From: tomo Date: Fri, 30 May 2008 11:57:57 +0000 (+0000) Subject: (www-ids-find-version): Update to 0.24.1. X-Git-Tag: chise-base-0_24~2 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd1bdad82b669f5334b7e23877d1fa0d2082600c;p=chise%2Fids.git (www-ids-find-version): Update to 0.24.1. (www-ids-find-format-char): Add new optional argument `code-desc'; don't display description of code when `code-desc' is not specified. (www-ids-find-format-line): Use `www-ids-find-format-char' with `code-desc' mode for a top character; use `www-ids-find-format-char' for IDS. --- diff --git a/www/www-ids-find.el b/www/www-ids-find.el index 482331e..28098fc 100644 --- a/www/www-ids-find.el +++ b/www/www-ids-find.el @@ -15,7 +15,7 @@ (concat dest (substring string i)) coding-system)))) -(defconst www-ids-find-version "0.24.0") +(defconst www-ids-find-version "0.24.1") (defvar www-ids-find-ideographic-products-file-name (expand-file-name "ideographic-products" @@ -31,7 +31,7 @@ (defvar www-ids-find-tang-chars-file-name "~tomo/projects/chise/ids/www/tang-chars.udd") -(defun www-ids-find-format-char (c) +(defun www-ids-find-format-char (c &optional code-desc) (let ((str (encode-coding-string (format "%c" c) 'utf-8-er)) plane code) (princ @@ -43,7 +43,8 @@ (insert str) (insert (format "\">\"CB%05d\"\n" code (/ code 1000) code)) - (insert (format "CB%05d" code)) + (when code-desc + (insert (format "CB%05d" code))) ) ((string-match "&JC3-\\([0-9A-F]+\\);" str) (setq code (string-to-int (match-string 1 str) 16)) @@ -51,7 +52,8 @@ (insert str) (insert (format "\">\"JC3-%04X\"\n" code code)) - (insert (format "JC3-%04X" code)) + (when code-desc + (insert (format "JC3-%04X" code))) ) ((string-match "&J\\(78\\|83\\|90\\|SP\\)-\\([0-9A-F]+\\);" str) (setq plane (match-string 1 str) @@ -62,7 +64,8 @@ plane code plane (- (lsh code -8) 32) (- (logand code 255) 32))) - (insert (format "J%s-%04X" plane code)) + (when code-desc + (insert (format "J%s-%04X" plane code))) ) ((string-match "&G\\([01]\\)-\\([0-9A-F]+\\);" str) (setq plane (string-to-int (match-string 1 str)) @@ -73,7 +76,8 @@ plane code plane (- (lsh code -8) 32) (- (logand code 255) 32))) - (insert (format "G%d-%04X" plane code)) + (when code-desc + (insert (format "G%d-%04X" plane code))) ) ((string-match "&C\\([1-7]\\)-\\([0-9A-F]+\\);" str) (setq plane (string-to-int (match-string 1 str)) @@ -82,7 +86,8 @@ (insert str) (insert (format "\">\"C%d-%04X\"\n" plane code plane code)) - (insert (format "C%d-%04X" plane code)) + (when code-desc + (insert (format "C%d-%04X" plane code))) ) ((string-match "&ZOB-\\([0-9]+\\);" str) (setq code (string-to-int (match-string 1 str))) @@ -90,7 +95,8 @@ (insert str) (insert (format "\">\"ZOB-%04d\"\n" code code)) - (insert (format "ZOB-%04d" code)) + (when code-desc + (insert (format "ZOB-%04d" code))) ) (t (insert "" - code (/ code 1000) code) - t 'literal)) - (buffer-string)))) + (setq ids (ideographic-structure-to-ids is)) + (setq i 0 + len (length ids)) + (while (< i len) + (www-ids-find-format-char (aref ids i)) + (setq i (1+ i)))) (when (and ucs (with-current-buffer (find-file-noselect