(www-feature-format): New function.
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Wed, 7 Apr 2010 23:15:25 +0000 (08:15 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Wed, 7 Apr 2010 23:15:25 +0000 (08:15 +0900)
(www-format-eval-unit): Support `:feature' property for `value'
related functions and `name' function.

cwiki-common.el

index a3e2ee0..72103fe 100644 (file)
          'structure)
         ))))
 
+(defun www-feature-format (feature-name)
+  (or (char-feature-property feature-name 'format)
+      (let (fn parent ret)
+       (setq fn feature-name)
+       (while (and (setq parent (char-feature-name-parent fn))
+                   (null (setq ret
+                               (char-feature-property
+                                parent 'format))))
+         (setq fn parent))
+       ret)
+      '((name) " : " (value))))
+
 (defun www-feature-value-format (feature-name)
   (or (char-feature-property feature-name 'value-format)
       (let (fn parent ret)
     (cond
      ((memq (car exp) '(value decimal hex HEX ku-ten kangxi-radical
                              S-exp string default))
+      (let ((fn (plist-get (nth 1 exp) :feature)))
+       (when fn
+         (when (stringp fn)
+           (setq fn (intern fn)))
+         (setq feature-name fn
+               value (www-char-feature char feature-name))))
       (if (eq (car exp) 'value)
          (www-format-eval-feature-value char feature-name
                                         (plist-get (nth 1 exp) :format)
         without-tags without-edit))
       )
      ((eq (car exp) 'name)
+      (let ((fn (plist-get (nth 1 exp) :feature)))
+       (when fn
+         (setq feature-name
+               (if (stringp fn)
+                   (intern fn)
+                 fn))))
       (if without-tags
          (www-format-feature-name feature-name lang)
        (format "<a href=\"%s?feature=%s&char=%s\">%s</a>"