From: MORIOKA Tomohiko Date: Sun, 28 Mar 2010 20:19:04 +0000 (+0900) Subject: (www-format-value-default): New function. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=efed7e5ca31a3a79e8b460e37ec67e02b472e3b3;p=chise%2Fest.git (www-format-value-default): New function. (www-format-encode-string): - Prefer `=gt' to `=cns11643-{1..7}'. - Display &(G-)GT-Kddddd; entity references. (www-format-apply-value): - New implementation for format `string'. - Use `www-format-value-default' for default format. --- diff --git a/cwiki-common.el b/cwiki-common.el index 4a30be9..d8b628a 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -323,6 +323,16 @@ (- (lsh value -8) 32) (- (logand value 255) 32))) +(defun www-format-value-default (value &optional without-tags) + (if (listp value) + (mapconcat + (lambda (unit) + (www-format-encode-string + (format "%S" unit) + without-tags)) + value " ") + (www-format-encode-string (format "%S" value) without-tags))) + (defun www-format-value-as-char-list (value &optional without-tags) (if (listp value) (mapconcat @@ -414,6 +424,7 @@ (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er) (let ((coded-charset-entity-reference-alist (list* + '(=gt "GT-" 5 d) '(=cns11643-1 "C1-" 4 X) '(=cns11643-2 "C2-" 4 X) '(=cns11643-3 "C3-" 4 X) @@ -429,7 +440,6 @@ '(=jis-x0208@1997 "J97-" 4 X) '(=jis-x0208@1978 "J78-" 4 X) '(=jis-x0208@1983 "J83-" 4 X) - '(=gt "GT-" 5 d) '(=zinbun-oracle "ZOB-" 4 d) '(=jef-china3 "JC3-" 4 X) '(=daikanwa "M-" 5 d) @@ -512,6 +522,16 @@ t 'literal)) (goto-char (point-min)) + (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t) + (setq code (string-to-int (match-string 2))) + (replace-match + (format "\"GT-K%05d\"" + code + chise-wiki-glyph-cgi-url + code) + t 'literal)) + + (goto-char (point-min)) (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t) (setq code (string-to-int (match-string 1) 16)) (replace-match @@ -610,12 +630,13 @@ (www-format-value-as-char-list value without-tags)) ((eq format 'space-separated-ids) (www-format-value-as-ids value without-tags)) + ((eq format 'string) + (www-format-encode-string (format "%s" value) without-tags) + ) (t - ;; (setq format 'default) - (www-format-encode-string - (format (www-format-props-to-string props 'default) - value) - without-tags)))) + (www-format-value-default value without-tags) + )) + ) (if (or without-tags (eq (plist-get props :mode) 'peek)) ret (format "%s