(www-format-encode-string): Display &U-hhhhhhhh;.
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Fri, 19 Mar 2010 05:48:10 +0000 (14:48 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Fri, 19 Mar 2010 05:48:10 +0000 (14:48 +0900)
(www-xml-format-props): Encode property value.
(www-xml-format-unit): Encode string.

cwiki-common.el

index 4f62691..f6aa4ad 100644 (file)
             t 'literal))
          
          (goto-char (point-min))
-         (while (re-search-forward "&UU\\+\\([0-9A-F]+\\);" nil t)
-           (setq code (string-to-int (match-string 1) 16))
+         (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\">"
                     code
          (setq key (substring key 1)))
       (setq dest
            (format "%s %s=\"%s\""
-                   dest key val)))
+                   dest key
+                   (www-format-encode-string
+                    (format "%s" val) 'without-tags))))
     dest))
 
 (defun www-xml-format-unit (format-unit)
   (let (name props children ret)
     (cond
      ((stringp format-unit)
-      format-unit)
+      (www-format-encode-string format-unit 'without-tags)
+      ;; (mapconcat (lambda (c)
+      ;;              (cond
+      ;;               ((eq c ?<) "&amp;lt;")
+      ;;               ((eq c ?>) "&amp;gt;")
+      ;;               (t
+      ;;                (char-to-string c))))
+      ;;            format-unit "")
+      )
      ((consp format-unit)
       (setq name (car format-unit)
            props (nth 1 format-unit)