(www-parse-string-default): New implementation.
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Sun, 28 Mar 2010 20:10:22 +0000 (05:10 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Sun, 28 Mar 2010 20:10:22 +0000 (05:10 +0900)
(www-set-display-feature-desc):
- New argument `format'.
- Display `value-format'.
(www-batch-set): Modify for the API change to set feature's property.

cwiki-set.el

index 1337b15..77cc431 100644 (file)
 (defun www-parse-string-default (string)
   (setq string (decode-uri-string string 'utf-8-mcs-er))
   (condition-case nil
-      (let ((ret
-            (mapcar #'read (split-string string " "))))
-       (if (cdr ret)
-           ret
-         (car ret)))
+      ;; (let ((ret
+      ;;        (mapcar #'read (split-string string " "))))
+      ;;   (if (cdr ret)
+      ;;       ret
+      ;;     (car ret)))
+      (let ((i 0)
+           (len (length string))
+           dest ret)
+       (while (< i len)
+         (setq ret (read-from-string string i))
+         (setq dest (cons (car ret) dest)
+               i (cdr ret)))
+       (if (cdr dest)
+           (nreverse dest)
+         (if (atom (car dest))
+             (car dest)
+           (nreverse dest))))
     (error nil)))
 
 (defun www-parse-string-as-space-separated-char-list (string)
               (www-format-encode-string uri-char)))
       )))
 
-(defun www-set-display-feature-desc (feature-name property-name value
+(defun www-set-display-feature-desc (feature-name property-name value format
                                                  &optional lang uri-char)
   (www-html-display-paragraph
    (format
-    "set: feature: %S, property-name: %S, value: %S, lang: %S, char: %S\n"
-    feature-name property-name value lang uri-char))
+    "set: feature: %S, property-name: %S, format: %S, value: %S, lang: %S, char: %S\n"
+    feature-name property-name format value lang uri-char))
+  (setq value (www-feature-parse-string property-name value format))
+  (www-html-display-paragraph
+   (format
+    "set: feature: %S, property-name: %S, format: %S, value: %S, lang: %S, char: %S\n"
+    feature-name property-name format value lang uri-char))
   (put-char-feature-property feature-name property-name value)
   (let ((name@lang (intern (format "name@%s" lang)))
        (uri-feature-name (www-uri-encode-feature-name feature-name)))
              (or (www-feature-type feature-name)
                 ;; (char-feature-property feature-name 'type)
                 'generic)))
+    (princ (format "<p>value-format : %s "
+                  (www-format-value
+                   nil 'value-format 
+                   (or (www-feature-value-format feature-name)
+                       'default)
+                   'default
+                   'without-tags)))
+    (princ
+     (format
+      " <a href=\"%s?feature=%s&property=value-format&format=wiki-text&char=%s\"
+><input type=\"submit\" value=\"edit\" /></a></p>"
+      chise-wiki-edit-url
+      uri-feature-name
+      uri-char))
     (www-html-display-paragraph
      (format "description : %s"
              (or (char-feature-property feature-name 'description)
                 lang)
               )
              ((eq (car ret) 'feature)
-              (setq prop (nth 2 target))
+              (setq prop (nth 3 target))
               (www-set-display-feature-desc
                (intern (decode-uri-string (cdr ret) 'utf-8-mcs-er))
+                (intern (decode-uri-string
+                        (cdr (assq 'feature-name (cdr target)))
+                        'utf-8-mcs-er))
+               (cdr prop) ; (decode-uri-string (cdr prop) 'utf-8-mcs-er)
                (car prop)
-               (decode-uri-string (cdr prop) 'utf-8-mcs-er)
                lang
                 (cdr (assq 'char target))
-               ;; (decode-uri-string (cdr (assq 'char target)))
                )
               ))
        (www-html-display-paragraph