(www-uri-decode-char):
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 18 Mar 2010 06:09:28 +0000 (15:09 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 18 Mar 2010 06:09:28 +0000 (15:09 +0900)
- Accept `:' again.
- Prefer `=>jis-x0208' and `=>jis-x0213-1' to `=big5' and `=big5-cdp'.
- Fix problem when no CCSes are found.
(www-format-feature-name*): New function.
(www-format-feature-name): Use `www-format-feature-name*'.

cwiki-common.el

index 8ef14b7..5a8cfda 100644 (file)
 (defun www-uri-decode-char (char-rep)
   (let (ccs cpos)
     (cond
-     ((string-match "%3A" char-rep)
+     ((string-match "\\(%3A\\|:\\)" char-rep)
       (setq ccs (substring char-rep 0 (match-beginning 0))
            cpos (substring char-rep (match-end 0)))
       (setq ccs (www-uri-decode-feature-name ccs))
                      =zinbun-oracle
                      =daikanwa
                      =gt =gt-k
-                     =big5
-                     =big5-cdp
                      =>>jis-x0208 =>>jis-x0213-1
-                     =>jis-x0208 =>jis-x0213-1))
+                     =>jis-x0208 =>jis-x0213-1
+                     =big5
+                     =big5-cdp))
          ccs ret)
       (while (and ccs-list
                  (setq ccs (pop ccs-list))
             (format "%s:0x%X"
                     (www-uri-encode-feature-name ccs)
                     ret))
-           ((setq ccs (car (split-char char)))
+           ((and (setq ccs (car (split-char char)))
+                 (setq ret (encode-char char ccs)))
             (format "%s:0x%X"
                     (www-uri-encode-feature-name ccs)
-                    (encode-char char ccs)))))))
+                    ret))
+           (t
+            (format "system-char-id:0x%X"
+                    (encode-char char 'system-char-id))
+            )))))
 
 
 ;;; @ Feature name presentation
       )
      (t dest))))
 
-(defun www-format-feature-name (feature-name &optional lang)
+(defun www-format-feature-name* (feature-name &optional lang)
   (let (name)
-    (www-format-encode-string
-     (cond
-      ((or (and lang
-               (char-feature-property
-                feature-name
-                (intern (format "name@%s" lang))))
-          (char-feature-property
-           feature-name 'name)))
-      ((find-charset feature-name)
-       (www-format-feature-name-as-CCS feature-name))
-      ((and (setq name (symbol-name feature-name))
-           (string-match "^\\(->\\)" name))
-       (www-format-feature-name-as-rel-to feature-name))
-      ((string-match "^\\(<-\\)" name)
-       (www-format-feature-name-as-rel-from feature-name))
-      (t
-       (www-format-feature-name-default feature-name))))))
+    (cond
+     ((or (and lang
+              (char-feature-property
+               feature-name
+               (intern (format "name@%s" lang))))
+         (char-feature-property
+          feature-name 'name)))
+     ((find-charset feature-name)
+      (www-format-feature-name-as-CCS feature-name))
+     ((and (setq name (symbol-name feature-name))
+          (string-match "^\\(->\\)" name))
+      (www-format-feature-name-as-rel-to feature-name))
+     ((string-match "^\\(<-\\)" name)
+      (www-format-feature-name-as-rel-from feature-name))
+     (t
+      (www-format-feature-name-default feature-name)))))
+
+(defun www-format-feature-name (feature-name &optional lang)
+  (www-format-encode-string
+   (www-format-feature-name* feature-name lang)))
 
 
 ;;; @ Feature value presentation