(chise-wiki-edit-url): Changed to "edit.cgi".
[chise/est.git] / cwiki-common.el
index 34e6380..fa6a4e8 100644 (file)
@@ -2,7 +2,7 @@
 (require 'char-db-util)
 
 (defvar chise-wiki-view-url "view.cgi")
-(defvar chise-wiki-edit-url "edit/edit.cgi")
+(defvar chise-wiki-edit-url "edit.cgi")
 
 (defvar chise-wiki-bitmap-glyphs-url
   "http://chise.zinbun.kyoto-u.ac.jp/glyphs")
                      =>>jis-x0208 =>>jis-x0213-1
                      =>jis-x0208 =>jis-x0213-1
                      =>>gt
+                     =ruimoku-v6
                      =big5
                      =big5-cdp))
          ccs ret)
     (www-format-value-as-S-exp value)))
 
 (defun www-format-value (object feature-name
-                               &optional value format without-tags)
+                               &optional value format
+                               without-tags without-edit)
   (unless value
     (setq value (www-char-feature object feature-name)))
   (www-format-apply-value object feature-name
-                         format nil value nil nil without-tags)
+                         format nil value nil nil
+                         without-tags without-edit)
   )
 
 
                '(=jis-x0208@1997       "J97-" 4 X)
                '(=jis-x0208@1978       "J78-" 4 X)
                '(=jis-x0208@1983       "J83-" 4 X)
+               '(=ruimoku-v6           "RUI6-" 4 X)
                '(=zinbun-oracle        "ZOB-" 4 d)
                '(=jef-china3           "JC3-" 4 X)
                '(=daikanwa             "M-" 5 d)
                     chise-wiki-glyph-cgi-url
                     code)
             t 'literal))
-         
+
+         (goto-char (point-min))
+         (while (re-search-forward "&RUI6-\\([0-9A-F]+\\);" nil t)
+           (setq code (string-to-int (match-string 1) 16))
+           (replace-match
+            (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\">"
+                    code
+                    chise-wiki-glyph-cgi-url
+                    code)
+            t 'literal))
+
          (goto-char (point-min))
          (while (re-search-forward "&\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
            (setq code (string-to-int (match-string 2) 16))
     (setq format (plist-get props :format)))
   (concat "%"
          (plist-get props :flag)
-         (if (plist-get props :zero-padding)
-             "0")
+          ;; (if (plist-get props :zero-padding)
+          ;;     "0")
          (if (plist-get props :len)
-             (format "%d" (plist-get props :len)))
+             (format "0%d" (plist-get props :len)))
          (cond
           ((eq format 'decimal) "d")
           ((eq format 'hex) "x")
 (defun www-format-apply-value (object feature-name
                                      format props value
                                      &optional uri-char uri-feature
-                                     without-tags)
+                                     without-tags without-edit)
   (let (ret)
     (setq ret
          (cond
           ((eq format 'wiki-text)
            (if without-tags
                (www-xml-format-list value)
-             (www-format-eval-list value object feature-name nil uri-char))
+             (www-format-eval-list value object feature-name nil uri-char
+                                   without-tags without-edit))
            )
           ((eq format 'S-exp)
            (www-format-encode-string
            (www-format-value-default value without-tags)
             ))
          )
-    (if (or without-tags (eq (plist-get props :mode) 'peek))
+    (if (or without-tags
+           without-edit
+           (eq (plist-get props :mode) 'peek))
        ret
       (format "%s <a href=\"%s?char=%s&feature=%s&format=%s\"
 ><input type=\"submit\" value=\"edit\" /></a>"
 
 (defun www-format-eval-feature-value (char
                                      feature-name
-                                     &optional format lang uri-char value)
+                                     &optional format lang uri-char value
+                                     without-tags without-edit)
   (unless value
     (setq value (www-char-feature char feature-name)))
   (unless format
     (www-format-apply-value
      char feature-name
      format nil value
-     uri-char (www-uri-encode-feature-name feature-name))
+     uri-char (www-uri-encode-feature-name feature-name)
+     without-tags without-edit)
     )
    ((consp format)
     (cond ((null (cdr format))
           (www-format-apply-value
            char feature-name
            (car format) (nth 1 format) value
-           uri-char (www-uri-encode-feature-name feature-name))
+           uri-char (www-uri-encode-feature-name feature-name)
+           without-tags without-edit)
           )
          (t
-          (www-format-eval-list format char feature-name lang uri-char)
+          (www-format-eval-list format char feature-name lang uri-char
+                                without-tags without-edit)
           )))))
 
 (defun www-format-eval-unit (exp char feature-name
-                                &optional lang uri-char value)
+                                &optional lang uri-char value
+                                without-tags without-edit)
   (unless value
     (setq value (www-char-feature char feature-name)))
   (unless uri-char
    ((consp exp)
     (cond
      ((memq (car exp) '(value decimal hex HEX ku-ten kangxi-radical
-                             S-exp default))
+                             S-exp string default))
       (if (eq (car exp) 'value)
          (www-format-eval-feature-value char feature-name
                                         (plist-get (nth 1 exp) :format)
-                                        lang uri-char value)
+                                        lang uri-char value
+                                        without-tags without-edit)
        (www-format-apply-value
         char feature-name
         (car exp) (nth 1 exp) value
-        uri-char (www-uri-encode-feature-name feature-name)))
+        uri-char (www-uri-encode-feature-name feature-name)
+        without-tags without-edit))
       )
      ((eq (car exp) 'name)
       (format "<a href=\"%s?feature=%s&char=%s\">%s</a>"
 >%s</a
 >"
              (www-format-eval-list (plist-get (nth 1 exp) :ref)
-                                   char feature-name lang uri-char)
+                                   char feature-name lang uri-char
+                                   'without-tags 'without-edit)
              (www-format-eval-list (nthcdr 2 exp)
-                                   char feature-name lang uri-char)))
+                                   char feature-name lang uri-char
+                                   without-tags without-edit)))
      (t
       (format "<%s
 >%s</%s
 >"
              (car exp)
              (www-format-eval-list (nthcdr 2 exp) char feature-name
-                                   lang uri-char)
+                                   lang uri-char
+                                   without-tags without-edit)
              (car exp)))))))
 
 (defun www-format-eval-list (format-list char feature-name
-                                        &optional lang uri-char)
+                                        &optional lang uri-char
+                                        without-tags without-edit)
   (if (consp format-list)
       (mapconcat
        (lambda (exp)
-        (www-format-eval-unit exp char feature-name lang uri-char))
+        (www-format-eval-unit exp char feature-name lang uri-char
+                              nil without-tags without-edit))
        format-list "")
-    (www-format-eval-unit format-list char feature-name lang uri-char)))
+    (www-format-eval-unit format-list char feature-name lang uri-char
+                         nil without-tags without-edit)))
 
 
 ;;; @ XML generator