From: tomo Date: Tue, 17 May 2005 11:10:07 +0000 (+0000) Subject: (www-ids-find-format-line): New function. X-Git-Tag: chise-core-0_22~29 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=da3d1a5cd57b8d6dc7163360137568be9d95c4da;p=chise%2Fids.git (www-ids-find-format-line): New function. (www-batch-ids-find): Use `www-ids-find-format-line'; if only one character is specified as components, display the character. --- diff --git a/www/www-ids-find.el b/www/www-ids-find.el index 5b88581..e48e6ea 100644 --- a/www/www-ids-find.el +++ b/www/www-ids-find.el @@ -18,6 +18,61 @@ (defvar www-ids-find-tang-chars-file-name "~tomo/projects/chise/ids/www/tang-chars.udd") +(defun www-ids-find-format-line (c is) + (let ((str (encode-coding-string (format "%c" c) 'utf-8-jp-er)) + code ucs) + (cond + ((string-match "&CB\\([0-9]+\\);" str) + (setq code (string-to-int (match-string 1 str))) + (princ (format "\"CB%05d\"\n" + code (/ code 1000) code)) + (princ (format "CB%05d" code)) + ) + (t + (princ str))) + (princ + (or (if (setq ucs (or (char-ucs c) + (encode-char c 'ucs))) + (format " %s" + ucs + (cond ((<= ucs #xFFFF) + (format "U+%04X" ucs)) + ((<= ucs #x10FFFF) + (format "U-%08X" ucs)))) + " "))) + (princ " ") + (when is + (princ + (with-temp-buffer + (insert + (encode-coding-string + (ideographic-structure-to-ids is) + 'utf-8-jp-er)) + (goto-char (point-min)) + (while (re-search-forward "&CB\\([0-9]+\\);" nil t) + (setq code (string-to-int (match-string 1))) + (replace-match + (format "\"CB%05d\"" + code (/ code 1000) code) + t 'literal)) + (buffer-string)))) + (when (and ucs + (with-current-buffer + (find-file-noselect + www-ids-find-tang-chars-file-name) + (goto-char (point-min)) + (re-search-forward (format "^%d$" ucs) nil t))) + (princ + (format " " + (mapconcat + (lambda (c) + (format "%%%02X" (char-int c))) + (encode-coding-string (char-to-string c) + 'utf-8-jp) + ""))) + (princ (encode-coding-string "⇒[唐代拓本]" 'utf-8-jp-er))) + (princ "
\n"))) + (defun www-batch-ids-find () (let ((components (car command-line-args-left)) (coded-charset-entity-reference-alist @@ -25,7 +80,7 @@ '((=cbeta "CB" 5 d) (=jef-china3 "JC3-" 4 X)) coded-charset-entity-reference-alist)) - is ucs str code) + is) (setq command-line-args-left (cdr command-line-args-left)) (cond ((stringp components) @@ -81,72 +136,22 @@ ;; ) ;; nil) ;; 'ideographic-structure) + (when (= (length components) 1) + (www-ids-find-format-line (aref components 0) nil)) (dolist (c (ideographic-products-find components)) (setq is (char-feature c 'ideographic-structure)) ;; to avoid problems caused by wrong indexes (when (every (lambda (c) (ideographic-structure-member c is)) components) - (setq str - (encode-coding-string (format "%c" c) 'utf-8-jp-er)) - (cond - ((string-match "&CB\\([0-9]+\\);" str) - (setq code (string-to-int (match-string 1 str))) - (princ (format "\"CB%05d\"\n" - code (/ code 1000) code)) - (princ (format "CB%05d" code)) - ) - (t - (princ str))) - (princ - (or (if (setq ucs (or (char-ucs c) - (encode-char c 'ucs))) - (format " %s" - ucs - (cond ((<= ucs #xFFFF) - (format "U+%04X" ucs)) - ((<= ucs #x10FFFF) - (format "U-%08X" ucs)))) - " "))) - (princ " ") - (princ - (with-temp-buffer - (insert - (encode-coding-string - (ideographic-structure-to-ids is) - 'utf-8-jp-er)) - (goto-char (point-min)) - (while (re-search-forward "&CB\\([0-9]+\\);" nil t) - (setq code (string-to-int (match-string 1))) - (replace-match - (format "\"CB%05d\"" - code (/ code 1000) code) - t 'literal)) - (buffer-string))) - (when (and ucs - (with-current-buffer - (find-file-noselect - www-ids-find-tang-chars-file-name) - (goto-char (point-min)) - (re-search-forward (format "^%d$" ucs) nil t))) - (princ - (format " " - (mapconcat - (lambda (c) - (format "%%%02X" (char-int c))) - (encode-coding-string (char-to-string c) - 'utf-8-jp) - ""))) - (princ (encode-coding-string "⇒[唐代拓本]" 'utf-8-jp-er))) - (princ "
\n") - )) + (www-ids-find-format-line c is))) ) (t (princ (encode-coding-string "

指定した部品を全て含む漢字の一覧を表示します。

-CHISE で用いられる実態参照形式(例:&M-00003;)で部品を指定する事もできます。" 'utf-8-jp-er)) +CHISE で用いられる実態参照形式(例:&M-00256;)で部品を指定する事もできます。" 'utf-8-jp-er)) )) (princ "


") (princ