From 341354b4254ffe2de2f3461a111279e912acb0dd Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Mar 2010 21:25:12 +0900 Subject: [PATCH] (www-parse-string-as-space-separated-ids): New function. (www-parse-string-as-ku-ten): New function. (www-feature-parse-string): Support `space-separated-ids' and `ku-ten'. --- cwiki-set.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cwiki-set.el b/cwiki-set.el index fc0b541..0a92436 100644 --- a/cwiki-set.el +++ b/cwiki-set.el @@ -13,11 +13,35 @@ (setq dest (cons char dest)))) (nreverse dest))) +(defun www-parse-string-as-space-separated-ids (string) + (ids-parse-string + (let (char) + (mapconcat + (lambda (unit) + (if (setq char (www-uri-decode-char unit)) + (char-to-string char) + unit)) + (split-string string " ") + "")))) + +(defun www-parse-string-as-ku-ten (string) + (if (string-match "^\\([0-9][0-9]?\\)-\\([0-9][0-9]?\\)" string) + (let ((ku (string-to-int (match-string 1 string))) + (ten (string-to-int (match-string 2 string)))) + (if (and (<= 1 ku)(<= ku 94) + (<= 1 ten)(<= ten 94)) + (+ (lsh (+ ku 32) 8) + ten 32))))) + (defun www-feature-parse-string (feature-name string &optional format) (unless format (setq format (www-feature-value-format feature-name))) (cond ((eq format 'space-separated-char-list) (www-parse-string-as-space-separated-char-list string)) + ((eq format 'space-separated-ids) + (www-parse-string-as-space-separated-ids string)) + ((eq format 'ku-ten) + (www-parse-string-as-ku-ten string)) ((eq format 'decimal) (string-to-number string)) ((or (eq format 'HEX)(eq format 'hex)) -- 1.7.10.4