From 4bbe975a4943122050924a17f29f24e6d2312c8d Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Mar 2010 20:49:58 +0900 Subject: [PATCH] (www-feature-value-format): Return 'space-separated-ids for `structure' type features. (www-format-value-as-ids): New function. (www-format-apply-value): Use `www-format-value-as-ids' for format `space-separated-ids'. --- cwiki-common.el | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/cwiki-common.el b/cwiki-common.el index 7089c36..6569ac4 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -40,9 +40,11 @@ (defun www-feature-value-format (feature-name) (or (char-feature-property feature-name 'value-format) - (if (memq (www-feature-type feature-name) - '(relation structure)) - 'space-separated-char-list) + (let ((type (www-feature-type feature-name))) + (cond ((eq type 'relation) + 'space-separated-char-list) + ((eq type 'structure) + 'space-separated-ids))) (if (find-charset feature-name) (if (and (= (charset-dimension feature-name) 2) (= (charset-chars feature-name) 94)) @@ -272,6 +274,27 @@ value " ") (www-format-encode-string (format "%s" value) without-tags))) +(defun www-format-value-as-ids (value &optional without-tags) + (if (listp value) + (mapconcat + (if without-tags + (lambda (unit) + (www-format-encode-string + (format (if (characterp unit) + "%c" + "%s") + unit) + 'without-tags)) + (lambda (unit) + (if (characterp unit) + (format "%s" + chise-wiki-view-url + (www-uri-encode-char unit) + (www-format-encode-string (char-to-string unit))) + (www-format-encode-string (format "%s" unit))))) + (ideographic-structure-to-ids value) " ") + (www-format-encode-string (format "%s" value) without-tags))) + (defun www-format-value-as-S-exp (value &optional without-tags) (www-format-encode-string (format "%S" value) without-tags)) @@ -441,6 +464,8 @@ (www-format-value-as-kuten value)) ((eq format 'space-separated-char-list) (www-format-value-as-char-list value without-tags)) + ((eq format 'space-separated-ids) + (www-format-value-as-ids value without-tags)) (t (setq format 'default) (www-format-encode-string -- 1.7.10.4