From: MORIOKA Tomohiko Date: Tue, 16 Mar 2010 11:49:58 +0000 (+0900) Subject: (www-feature-value-format): Return 'space-separated-ids for X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bbe975a4943122050924a17f29f24e6d2312c8d;p=chise%2Fest.git (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'. --- 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