(www-set-display-char-desc): Store new value into FEATURE@$rev=latest;
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 18 Mar 2010 12:22:51 +0000 (21:22 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 18 Mar 2010 12:22:51 +0000 (21:22 +0900)
don't display `$rev=latest' domain features.

cwiki-set.el

index 9d8156f..0429584 100644 (file)
@@ -74,7 +74,9 @@
     (setq feature (intern feature)))
   (when (stringp format)
     (setq format (intern format)))
-  (let ((char (www-uri-decode-char uri-char)))
+  (let ((char (www-uri-decode-char uri-char))
+       latest-feature
+       feature-name logical-feature displayed-features)
     (when (characterp char)
       (princ
        (encode-coding-string
               uri-char feature value lang))
       (setq value (www-feature-parse-string feature value format))
       (www-html-display-paragraph
-       (format "char = %c" char))
-      (www-html-display-paragraph
-       (format "feature-name = %S" feature))
-      (www-html-display-paragraph
-       (format "feature-value = %S" value))
+       (format "char = %c : %S \u2190 %S"
+              char feature value))
+      (setq latest-feature
+           (char-feature-name-at-domain feature '$rev=latest))
+      (if value
+         (if (equal (www-char-feature char feature) value)
+             (www-html-display-paragraph
+              "Feature-value is not changed.")
+           (www-html-display-paragraph
+            (format "New feature-value = %S is different from old value %S"
+                    value
+                    (www-char-feature char feature)))
+           (put-char-attribute char latest-feature value)
+           (save-char-attribute-table latest-feature)
+           )
+       (www-html-display-paragraph
+        "New feature-value is nil, so it is ignored (may be syntax error).")
+       )
       (princ (format "<h1>%s</h1>\n"
                     (www-format-encode-string (char-to-string char))))
       (dolist (cell (sort (char-attribute-alist char)
                          (lambda (a b)
                            (char-attribute-name< (car a)(car b)))))
-       (princ "<p>")
-       (princ
-        (www-format-eval-list
-         (or (char-feature-property (car cell) 'format)
-             '((name) " : " (value)))
-         char (car cell) lang uri-char))
-       (princ
-        (format " <a href=\"%s?char=%s&feature=%s\"
+       (setq feature-name (symbol-name (car cell)))
+       (setq logical-feature
+             (if (string-match "[@/]\\$rev=latest$" feature-name)
+                 (intern (substring feature-name 0 (match-beginning 0)))
+               (car cell)))
+       (unless (memq logical-feature displayed-features)
+         (push logical-feature displayed-features)
+         (princ "<p>")
+         (princ
+          (www-format-eval-list
+           (or (char-feature-property (car cell) 'format)
+               '((name) " : " (value)))
+           char (car cell) lang uri-char))
+         (princ
+          (format " <a href=\"%s?char=%s&feature=%s\"
 ><input type=\"submit\" value=\"note\" /></a>"
-                chise-wiki-edit-url
-                (www-format-encode-string uri-char)
-                (www-format-encode-string
-                 (www-uri-encode-feature-name
-                  (intern (format "%s*note" (car cell)))))))
-       (princ "</p>\n")
-       )
+                  chise-wiki-edit-url
+                  (www-format-encode-string uri-char)
+                  (www-format-encode-string
+                   (www-uri-encode-feature-name
+                    (intern (format "%s*note" (car cell)))))))
+         (princ "</p>\n")
+         ))
       (princ
        (format "<p><a href=\"%s?char=%s\"
 ><input type=\"submit\" value=\"add feature\" /></a></p>"