From 75dc7c2d2e58382dc34494661979cef4f369e77d Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Thu, 9 Dec 2010 09:51:35 +0900 Subject: [PATCH] (chise-wiki-bitmap-glyphs-url): Use http://www.chise.org/glyphs 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 "&". - Specify style of tags. --- cwiki-common.el | 85 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 25 deletions(-) diff --git a/cwiki-common.el b/cwiki-common.el index f2612ae..9e14138 100644 --- a/cwiki-common.el +++ b/cwiki-common.el @@ -22,10 +22,10 @@ (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) @@ -454,6 +454,13 @@ (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 ;;; @@ -551,10 +558,16 @@ ;;; @ 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 "&" nil t))) (goto-char (point-min)) (while (search-forward "<" nil t) (replace-match "<" nil t)) @@ -592,10 +605,12 @@ (while (re-search-forward "&CB\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 1))) (replace-match - (format "\"CB%05d\"" + (format "\"CB%05d\"" code chise-wiki-bitmap-glyphs-url - (/ code 1000) code) + (/ code 1000) code + www-format-char-img-style) t 'literal)) (goto-char (point-min)) @@ -603,12 +618,14 @@ (setq plane (match-string 1) code (string-to-int (match-string 2) 16)) (replace-match - (format "\"J%s-%04X\"" + (format "\"J%s-%04X\"" 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)) @@ -616,12 +633,14 @@ (setq plane (string-to-int (match-string 1)) code (string-to-int (match-string 2) 16)) (replace-match - (format "\"GB%d-%04X\"" + (format "\"GB%d-%04X\"" 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)) @@ -629,10 +648,12 @@ (setq plane (string-to-int (match-string 1)) code (string-to-int (match-string 2) 16)) (replace-match - (format "\"CNS%d-%04X\"" + (format "\"CNS%d-%04X\"" plane code chise-wiki-bitmap-glyphs-url - plane code) + plane code + www-format-char-img-style) t 'literal)) (goto-char (point-min)) @@ -647,69 +668,83 @@ (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t) (setq code (string-to-int (match-string 2))) (replace-match - (format "\"ZOB-%04d\"" + (format "\"ZOB-%04d\"" 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 "\"GT-%05d\"" + (format "\"GT-%05d\"" 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 "\"GT-K%05d\"" + (format "\"GT-K%05d\"" 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 "\"B-%04X\"" + (format "\"B-%04X\"" 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 "\"CDP-%04X\"" + (format "\"CDP-%04X\"" 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 "\"RUI6-%04X\"" + (format "\"RUI6-%04X\"" 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 "\"UU+%04X\"" + (format "\"UU+%04X\"" + code code - code) + www-format-char-img-style) t 'literal)) (goto-char (point-min)) -- 1.7.10.4