From: MORIOKA Tomohiko Date: Tue, 16 Mar 2010 12:25:12 +0000 (+0900) Subject: (www-parse-string-as-space-separated-ids): New function. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=341354b4254ffe2de2f3461a111279e912acb0dd;p=chise%2Fest.git (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'. --- 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))