(chise-wiki-bitmap-glyphs-url): Use http://www.chise.org/glyphs
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 9 Dec 2010 00:51:35 +0000 (09:51 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Thu, 9 Dec 2010 00:51:35 +0000 (09:51 +0900)
instead of http://chise.zinbun.kyoto-u.ac.jp/glyphs.
(chise-wiki-glyph-cgi-url): Use
http://www.chise.org/chisewiki/glyph.cgi instead of
http://chise.zinbun.kyoto-u.ac.jp/chisewiki/glyph.cgi.
(www-uri-make-object-url): New function.
(www-format-char-img-style): New variable.
(www-format-encode-string):
- Add new optional argument `as-body'; if it is specified, "&" is
  encoded to "&amp;".
- Specify style of <img> tags.

cwiki-common.el

index f2612ae..9e14138 100644 (file)
 (defvar chise-wiki-edit-url "edit.cgi")
 
 (defvar chise-wiki-bitmap-glyphs-url
-  "http://chise.zinbun.kyoto-u.ac.jp/glyphs")
+  "http://www.chise.org/glyphs")
 
 (defvar chise-wiki-glyph-cgi-url
-  "http://chise.zinbun.kyoto-u.ac.jp/chisewiki/glyph.cgi")
+  "http://www.chise.org/chisewiki/glyph.cgi")
 
 (defvar chise-wiki-displayed-features nil)
 
       (char-to-string object)
     (format "%s" (concord-object-id object))))
 
+(defun www-uri-make-object-url (object &optional uri-object)
+  (format "%s?%s=%s"
+         chise-wiki-view-url
+         (est-object-genre object)
+         (or uri-object
+             (www-uri-encode-object object))))
+
 
 ;;; @ Feature name presentation
 ;;;
 ;;; @ HTML generator
 ;;;
 
-(defun www-format-encode-string (string &optional without-tags)
+(defvar www-format-char-img-style "vertical-align:bottom;")
+
+(defun www-format-encode-string (string &optional without-tags as-body)
   (with-temp-buffer
     (insert string)
     (let (plane code start end char variants ret rret)
+      (when as-body
+       (goto-char (point-min))
+       (while (search-forward "&" nil t)
+         (replace-match "&amp;" nil t)))
       (goto-char (point-min))
       (while (search-forward "<" nil t)
        (replace-match "&lt;" nil t))
          (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
            (setq code (string-to-int (match-string 1)))
            (replace-match
-            (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\">"
+            (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\"
+style=\"%s\">"
                     code
                     chise-wiki-bitmap-glyphs-url
-                    (/ code 1000) code)
+                    (/ code 1000) code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
            (setq plane (match-string 1)
                  code (string-to-int (match-string 2) 16))
            (replace-match
-            (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\">"
+            (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\"
+style=\"%s\">"
                     plane code
                     chise-wiki-bitmap-glyphs-url
                     plane
                     (- (lsh code -8) 32)
-                    (- (logand code 255) 32))
+                    (- (logand code 255) 32)
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
            (setq plane (string-to-int (match-string 1))
                  code (string-to-int (match-string 2) 16))
            (replace-match
-            (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\">"
+            (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\"
+style=\"%s\">"
                     plane code
                     chise-wiki-bitmap-glyphs-url
                     plane
                     (- (lsh code -8) 32)
-                    (- (logand code 255) 32))
+                    (- (logand code 255) 32)
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
            (setq plane (string-to-int (match-string 1))
                  code (string-to-int (match-string 2) 16))
            (replace-match
-            (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\">"
+            (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\"
+style=\"%s\">"
                     plane code
                     chise-wiki-bitmap-glyphs-url
-                    plane code)
+                    plane code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
          (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
            (setq code (string-to-int (match-string 2)))
            (replace-match
-            (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\">"
+            (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\"
+style=\"vertical-align:middle\">"
                     code
                     chise-wiki-bitmap-glyphs-url
-                    code)
+                    code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
          (while (re-search-forward "&\\(G-\\)?GT-\\([0-9]+\\);" nil t)
            (setq code (string-to-int (match-string 2)))
            (replace-match
-            (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\">"
+            (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\"
+style=\"%s\">"
                     code
                     chise-wiki-glyph-cgi-url
-                    code)
+                    code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
          (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t)
            (setq code (string-to-int (match-string 2)))
            (replace-match
-            (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\">"
+            (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\"
+style=\"%s\">"
                     code
                     chise-wiki-glyph-cgi-url
-                    code)
+                    code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
          (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
            (setq code (string-to-int (match-string 1) 16))
            (replace-match
-            (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\">"
+            (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\"
+style=\"%s\">"
                     code
                     chise-wiki-glyph-cgi-url
-                    code)
+                    code
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))
          (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t)
            (setq code (string-to-int (match-string 1) 16))
            (replace-match
-            (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\">"
+            (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\"
+style=\"%s\">"
                     code
                     chise-wiki-glyph-cgi-url
-                    code)
+                    code
+                    www-format-char-img-style)
             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\">"
+            (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\"
+style=\"vertical-align:middle\">"
                     code
                     chise-wiki-glyph-cgi-url
-                    code)
+                    code
+                    www-format-char-img-style)
             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))
            (replace-match
-            (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\">"
+            (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\"
+style=\"vertical-align:middle\">"
+                    code
                     code
-                    code)
+                    www-format-char-img-style)
             t 'literal))
 
          (goto-char (point-min))