From: MORIOKA Tomohiko Date: Mon, 29 Mar 2010 00:49:19 +0000 (+0900) Subject: (www-parse-string-as-kangxi-radical): New function. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9a78cf2764abaa3e1b23bb4c681d4e65d04cb6b6;p=chise%2Fest.git (www-parse-string-as-kangxi-radical): New function. (www-feature-parse-string): Support format `kangxi-radical'. --- diff --git a/cwiki-set.el b/cwiki-set.el index 77cc431..183c82d 100644 --- a/cwiki-set.el +++ b/cwiki-set.el @@ -125,6 +125,27 @@ (+ (lsh (+ ku 32) 8) ten 32))))) +(defun www-parse-string-as-kangxi-radical (string) + (setq string (decode-uri-string string 'utf-8-mcs-er)) + (let ((i 0) + (len (length string)) + char ret) + (while (and (< i len) + (setq char (aref string i)) + (not + (and (setq ret (char-ucs char)) + (<= #x2F00 ret) + (<= ret #x2FD5))) + (not (setq ret (char-feature char '->radical)))) + (setq i (1+ i))) + (if (integerp ret) + (- ret #x2EFF) + (and (setq ret (car ret)) + (setq ret (char-ucs ret)) + (<= #x2F00 ret) + (<= ret #x2FD5) + (- ret #x2EFF))))) + (defun www-parse-string-as-wiki-text (string) (www-stext-parse-xml-string (decode-uri-string string 'utf-8-mcs-er)) @@ -147,6 +168,8 @@ ((eq format 'string) (decode-uri-string string 'utf-8-mcs-er) ) + ((eq format 'kangxi-radical) + (www-parse-string-as-kangxi-radical string)) ((eq format 'wiki-text) (www-parse-string-as-wiki-text string) )