(coded-charset-GlyphWiki-id-alist): Add setting for `=ucs@jis',
[chise/est.git] / cwiki-edit.el
index 45d19c0..9bcda3b 100644 (file)
@@ -4,30 +4,30 @@
 
 (require 'cwiki-common)
 
-(defun www-edit-display-char-feature-default (char feature-name &optional value
-                                             lang)
-  (unless value
-    (setq value (www-char-feature char feature-name)))
-  (www-html-display-paragraph
-   (format "[[%s|%s?feature=%s]] : %s [[[edit|edit.cgi?char=%s&feature=%s]]]"
-          (www-format-feature-name feature-name lang)
-          chise-wiki-view-url
-          (www-uri-encode-feature-name feature-name)
-          (www-format-value value feature-name nil 'without-tags)
-          (char-to-string char)
-          (www-uri-encode-feature-name feature-name)
-          )))
+;; (defun www-edit-display-char-feature-default (char feature-name &optional value
+;;                                               lang)
+;;   (unless value
+;;     (setq value (www-char-feature char feature-name)))
+;;   (www-html-display-paragraph
+;;    (format "[[%s|%s?feature=%s]] : %s [[[edit|edit.cgi?char=%s&feature=%s]]]"
+;;            (www-format-feature-name feature-name lang)
+;;            chise-wiki-view-url
+;;            (www-uri-encode-feature-name feature-name)
+;;            (www-format-value char feature-name value nil 'without-tags)
+;;            (char-to-string char)
+;;            (www-uri-encode-feature-name feature-name)
+;;            )))
 
-(defun www-edit-display-char-feature-as-ucs (char feature-name &optional value)
-  (unless value
-    (setq value (www-char-feature char feature-name)))
-  (www-html-display-paragraph
-   (format "= [[U+%s|http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%s]] (%d)"
-          (www-format-value-as-HEX value)
-          (www-format-value-as-HEX value)
-          value)))
+;; (defun www-edit-display-char-feature-as-ucs (char feature-name &optional value)
+;;   (unless value
+;;     (setq value (www-char-feature char feature-name)))
+;;   (www-html-display-paragraph
+;;    (format "= [[U+%s|http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%s]] (%d)"
+;;            (www-format-value-as-HEX value)
+;;            (www-format-value-as-HEX value)
+;;            value)))
 
-(defun www-edit-display-input-box (name value &optional format)
+(defun www-edit-display-input-box (object name value &optional format)
   (when (stringp format)
     (setq format (intern format)))
   (let (prefix)
@@ -47,32 +47,42 @@ size=\"30\" maxlength=\"30\" value=\"%s\">
 "
             (www-format-encode-string
              (format "%s" name) 'without-tags)
-             (www-format-apply-value format nil value
+             (www-format-apply-value object name
+                                    format nil value
                                     nil nil
                                     'without-tags)
             ))))
 
 (defun www-edit-display-feature-input-box (char feature-name
-                                               &optional format)
+                                               &optional format value)
   (unless format
     (setq format 'default))
+  (unless value
+    (setq value (www-char-feature char feature-name)))
   (princ
    (format "<p><input type=\"text\" name=\"feature-name\"
-size=\"30\" maxlength=\"30\" value=\"%s\">"
+size=\"32\" maxlength=\"256\" value=\"%s\">"
           feature-name))
   (princ (encode-coding-string " \u2190 " 'utf-8-mcs-er))
   (princ
    (format "%s<input type=\"text\" name=\"%s\"
-size=\"30\" maxlength=\"30\" value=\"%s\">
+size=\"64\" maxlength=\"256\" value=\"%s\">
 <input type=\"submit\" value=\"set\" /></p>
 "
           (if (or (eq format 'HEX)(eq format 'hex))
               "0x"
             "")
           format
-          (www-format-value (www-char-feature char feature-name)
-                            feature-name
-                            format 'without-tags)))
+          (mapconcat (lambda (c)
+                       (cond
+                         ;; ((eq c ?<) "&amp;lt;")
+                         ;; ((eq c ?>) "&amp;gt;")
+                        ((eq c ?\u0022) "&quot;")
+                        (t
+                         (char-to-string c))))
+                     (www-format-value char feature-name
+                                       value format 'without-tags)
+                     "")))
   )
 
 (defun www-edit-display-char-desc (uri-char uri-feature-name
@@ -129,10 +139,7 @@ size=\"30\" maxlength=\"30\" value=\"%s\">)</p>
          (when (and (eq base-name (car cell)) metadata-name)
            (princ "<ul>\n")
            (princ "<li>")
-            ;; (www-edit-display-input-box feature-name
-            ;;                             (www-char-feature char feature-name)
-            ;;                             format)
-           (www-edit-display-feature-input-box char feature-name format)
+            (www-edit-display-feature-input-box char feature-name format)
            (princ "</li>")
            (princ "</ul>"))
          ))
@@ -170,9 +177,13 @@ size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
       'utf-8-mcs-er))
     (princ "<p>")
     (if (eq property-name 'name)
-       (www-edit-display-input-box
-        property-name
-        (or (www-format-feature-name* feature-name) ""))
+       ;; (www-edit-display-input-box
+        ;;  feature-name
+        ;;  property-name
+        ;;  (or (www-format-feature-name* feature-name) ""))
+       (www-edit-display-feature-input-box
+        feature-name property-name
+        'string (or (www-format-feature-name* feature-name) ""))
       (www-html-display-paragraph
        (format "name : %s [[[edit|edit.cgi?feature=%s&property=name]]]"
               (or (www-format-feature-name* feature-name) "")
@@ -182,9 +193,13 @@ size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
     (when lang
       (setq name@lang (intern (format "name@%s" lang)))
       (if (eq property-name name@lang)
-         (www-edit-display-input-box
-          name@lang
-          (or (char-feature-property feature-name name@lang) ""))
+          ;; (www-edit-display-input-box
+          ;;  feature-name
+          ;;  name@lang
+          ;;  (or (char-feature-property feature-name name@lang) ""))
+         (www-edit-display-feature-input-box
+          feature-name name@lang
+          'string (or (char-feature-property feature-name name@lang) ""))
        (www-html-display-paragraph
         (format "%s : %s [[[edit|edit.cgi?feature=%s&property=%s]]]"
                 name@lang
@@ -196,6 +211,20 @@ size=\"30\" maxlength=\"30\" value=\"%s\">に限\u5B9Aしない)
              (or (www-feature-type feature-name)
                 ;; (char-feature-property feature-name 'type)
                 'generic)))
+    (if (eq property-name 'value-format)
+       (www-edit-display-feature-input-box
+        feature-name property-name
+        'default ; 'wiki-text
+        (or (www-feature-value-format feature-name)
+            'default))
+      (www-html-display-paragraph
+       (format "value-format : %s [[[edit|edit.cgi?feature=%s&property=name]]]"
+              (www-xml-format-list
+               (or (www-feature-value-format feature-name)
+                   'default))
+              ;; (char-feature-property feature-name 'name)
+              uri-feature-name ; (www-uri-encode-feature-name feature-name)
+              )))
     (www-html-display-paragraph
      (format "description : %s"
              (or (char-feature-property feature-name 'description)