From 9a78cf2764abaa3e1b23bb4c681d4e65d04cb6b6 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Mon, 29 Mar 2010 09:49:19 +0900 Subject: [PATCH] (www-parse-string-as-kangxi-radical): New function. (www-feature-parse-string): Support format `kangxi-radical'. --- cwiki-set.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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) ) -- 1.7.10.4