annotate yahtml.el @ 57:18f4939986e6

(j)LaTeX2e supported yatex19.el fixed a lot
author yuuji
date Sat, 02 Dec 1995 18:35:28 +0000
parents 2d45e43fb35f
children 3a7c0c2bf16d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 15
diff changeset
2 ;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net.or.jp]
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3 ;;; Last modified Mon Nov 20 11:26:38 1995 on inspire
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
4 ;;; This is PURELY tentative.
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
5 ;;; $Id$
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
6
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
7 ;;;[Commentary]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
8 ;;;
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
9 ;;; It is assumed you are already familiar with YaTeX. The following
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
10 ;;; completing featureas are available: ([prefix] means `C-c' by default)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
11 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
12 ;;; * [prefix] b X Complete environments such as `H1' which
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
13 ;;; normally requires closing tag `</H1>
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
14 ;;; <a href=foo> ... </a> is also classified into
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
15 ;;; this group
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
16 ;;; * [prefix] s Complete declarative notations such as
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
17 ;;; `<img src="foo.gif">'
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
18 ;;; `<input name="var" ...>'
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
19 ;;; * [prefix] l Complete typeface-changing commands such as
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
20 ;;; `<i> ... </i>' or `<samp> ... </samp>'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
21 ;;; * [prefix] m Complete single commands such as
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
22 ;;; `<br>' or `<hr>'
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
23 ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
24 ;;; hate menu, this is most useful)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
25 ;;;
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
26 ;;; NOTE! This program is truly tentative. If you find some bright
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
27 ;;; future with this, please send me a mail to drive me to maintain this :)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
28
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
29
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
30 (require 'yatex)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
31 (defvar yahtml-prefix-map nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
32 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
33
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
34 (defun yahtml-define-begend-key-normal (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
35 "Define short cut yahtml-insert-begin-end key."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
36 (YaTeX-define-key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
37 key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
38 (list 'lambda '(arg) '(interactive "P")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
39 (list 'yahtml-insert-begin-end env 'arg))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
40 map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
41
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
42 (defun yahtml-define-begend-region-key (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
43 "Define short cut yahtml-insert-begin-end-region key."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
44 (YaTeX-define-key key (list 'lambda nil '(interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
45 (list 'yahtml-insert-begin-end env t)) map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
46
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
47 (defun yahtml-define-begend-key (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
48 "Define short cut key for begin type completion both for
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
49 normal and region mode. To customize yahtml, user should use this function."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
50 (yahtml-define-begend-key-normal key env map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
51 (if YaTeX-inhibit-prefix-letter nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
52 (yahtml-define-begend-region-key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
53 (concat (upcase (substring key 0 1)) (substring key 1)) env)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
54
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
55
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
56 (if yahtml-mode-map nil
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
57 (setq yahtml-mode-map (make-sparse-keymap)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
58 yahtml-prefix-map (make-sparse-keymap))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
59 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
60 (define-key yahtml-mode-map "\M-\C-@" 'YaTeX-mark-environment)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
61 (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
62 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
63 (define-key yahtml-mode-map "\C-i" 'YaTeX-indent-line)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
64 (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
65 (let ((map yahtml-prefix-map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
66 (YaTeX-define-key "^" 'yahtml-visit-main map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
67 (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
68 (YaTeX-define-key "4g" 'yahtml-goto-corresponding-*-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
69 (YaTeX-define-key "44" 'YaTeX-switch-to-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
70 (and YaTeX-emacs-19 window-system
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
71 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
72 (YaTeX-define-key "5^" 'yahtml-visit-main-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
73 (YaTeX-define-key "5g" 'yahtml-goto-corresponding-*-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
74 (YaTeX-define-key "55" 'YaTeX-switch-to-window map)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
75 (YaTeX-define-key "v" 'YaTeX-version map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
76 (YaTeX-define-key "}" 'YaTeX-insert-braces-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
77 (YaTeX-define-key "]" 'YaTeX-insert-brackets-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
78 (YaTeX-define-key ")" 'YaTeX-insert-parens-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
79 (YaTeX-define-key "s" 'yahtml-insert-form map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
80 (YaTeX-define-key "l" 'yahtml-insert-tag map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
81 (YaTeX-define-key "m" 'yahtml-insert-single map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
82 (YaTeX-define-key "n" '(lambda () (interactive) (insert "<br>\n")) map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
83 (if YaTeX-no-begend-shortcut
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
84 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
85 (YaTeX-define-key "B" 'yahtml-insert-begend-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
86 (YaTeX-define-key "b" 'yahtml-insert-begend map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
87 (yahtml-define-begend-key "bh" "HTML" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
88 (yahtml-define-begend-key "bH" "HEAD" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
89 (yahtml-define-begend-key "bt" "TITLE" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
90 (yahtml-define-begend-key "bb" "BODY" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
91 (yahtml-define-begend-key "bd" "DL" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
92 (yahtml-define-begend-key "b1" "H1" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
93 (yahtml-define-begend-key "b2" "H2" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
94 (yahtml-define-begend-key "b3" "H3" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
95 (yahtml-define-begend-key "ba" "a" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
96 (yahtml-define-begend-key "bf" "form" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
97 (yahtml-define-begend-key "bs" "select" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
98 (YaTeX-define-key "b " 'yahtml-insert-begend map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
99 (YaTeX-define-key "B " 'yahtml-insert-begend map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
100 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
101 (YaTeX-define-key "e" 'yahtml-end-environment map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
102 (YaTeX-define-key ">" 'yahtml-comment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
103 (YaTeX-define-key "<" 'yahtml-uncomment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
104 (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
105 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
106 )
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
107
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
108 (defvar yahtml-paragraph-separate
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
109 (concat
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
110 "^$\\|<br>\\|<p>\\|^[ \t]*</?\\(h[1-6]\\|p\\|dl\\|dd\\|dt\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\)>")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
111 "*Regexp of html paragraph separater")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
112 (defvar yahtml-syntax-table nil
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
113 "*Syntax table for typesetting buffer")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
114
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
115 (if yahtml-syntax-table nil
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
116 (setq yahtml-syntax-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
117 (make-syntax-table (standard-syntax-table)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
118 (modify-syntax-entry ?\< "(" yahtml-syntax-table)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
119 (modify-syntax-entry ?\> ")" yahtml-syntax-table)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
120 )
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
121 (defvar yahtml-command-regexp "[A-Za-z0-9]+"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
122 "Regexp of constituent of html commands.")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
123 (defvar yahtml-kanji-code 2
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
124 "Kanji coding system of html file; 1=sjis, 2=jis, 3=euc")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
125
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
126 ;;; Completion tables for `form'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
127 (defvar yahtml-form-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
128 '(("img") ("input")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
129 (defvar yahtml-user-form-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
130 (defvar yahtml-tmp-form-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
131
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
132 (defvar yahtml-env-table
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
133 '(("html") ("head") ("title") ("body") ("dl") ("a") ("form") ("select")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
134 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6") ("ul")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
135
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
136 (defvar yahtml-user-env-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
137 (defvar yahtml-tmp-env-table nil)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
138
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
139 ;;; Completion tables for typeface designator
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
140 (defvar yahtml-typeface-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
141 '(("defn") ("em") ("cite") ("code") ("kbd") ("samp")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
142 ("strong") ("var") ("b") ("i") ("tt") ("u") ("address"))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
143 "Default completion table of typeface designator")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
144 (defvar yahtml-user-typeface-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
145 (defvar yahtml-tmp-typeface-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
146
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
147 (defvar yahtml-single-cmd-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
148 '(("hr") ("br") ("option") ("p"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
149 "Default completion table of HTML single command.")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
150 (defvar yahtml-user-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
151 (defvar yahtml-tmp-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
152 (defvar yahtml-last-single-cmd nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
153
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
154 (defvar yahtml-prefer-upcases nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
155 (cond
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
156 (yahtml-prefer-upcases
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
157 (setq yahtml-form-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
158 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
159 yahtml-form-table))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
160 (setq yahtml-env-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
161 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
162 yahtml-env-table))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
163 (setq yahtml-typeface-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
164 (mapcar (function (lambda (list) (list (upcase (car list)))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
165 yahtml-typeface-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
166
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
167 (defvar yahtml-struct-name-regexp
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
168 "\\<\\(h[1-6]\\|[uod]l\\|body\\|title\\|head\\)")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
169
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
170
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
171 (defun yahtml-mode ()
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
172 (interactive)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
173 (yatex-mode)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
174 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
175 ((boundp 'MULE)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
176 (set-file-coding-system
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
177 (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
178 ((boundp 'NEMACS)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
179 (make-local-variable 'kanji-fileio-code)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
180 (setq kanji-fileio-code yahtml-kanji-code)))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
181 (setq major-mode 'yahtml-mode
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
182 mode-name "yahtml")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
183 (make-local-variable 'YaTeX-ec) (setq YaTeX-ec "")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
184 (make-local-variable 'YaTeX-struct-begin) (setq YaTeX-struct-begin "<%1%2>")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
185 (make-local-variable 'YaTeX-struct-end) (setq YaTeX-struct-end "</%1>")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
186 (make-local-variable 'YaTeX-struct-name-regexp)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
187 (setq YaTeX-struct-name-regexp yahtml-struct-name-regexp)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
188 (make-local-variable 'YaTeX-prefix-map)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
189 (make-local-variable 'YaTeX-command-token-regexp)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
190 (setq YaTeX-command-token-regexp yahtml-command-regexp)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
191 (make-local-variable 'YaTeX-environment-indent)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
192 (setq YaTeX-environment-indent 0)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
193 (make-local-variable 'fill-prefix)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
194 (setq fill-prefix nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
195 (make-local-variable 'paragraph-separate)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
196 (setq paragraph-separate yahtml-paragraph-separate
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
197 paragraph-start yahtml-paragraph-separate)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
198 (make-local-variable 'comment-start)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
199 (make-local-variable 'comment-end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
200 (setq comment-start "<!-- " comment-end " -->")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
201 (set-syntax-table yahtml-syntax-table)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
202 (use-local-map yahtml-mode-map)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
203 (run-hooks 'yahtml-mode-hook))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
204
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
205 (defun yahtml-define-menu (keymap bindlist)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
206 (mapcar
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
207 (function
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
208 (lambda (bind)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
209 (define-key keymap (vector (car bind)) (cdr bind))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
210 bindlist))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
211
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
212 (defvar yahtml-menu-map nil "Menu map of yahtml")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
213 (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
214 (defvar yahtml-menu-map-listing nil "Menu map of yahtml(listing)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
215 (defvar yahtml-menu-map-logical nil "Menu map of yahtml(logical tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
216 (defvar yahtml-menu-map-typeface nil "Menu map of yahtml(typeface tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
217
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
218 ;;; Variables for mosaic url history
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
219 (defvar yahtml-urls nil "Alist of global history")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
220 (defvar yahtml-url-history-file "~/.mosaic-global-history"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
221 "File name of url history")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
222
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
223 (cond
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
224 ((and YaTeX-emacs-19 (null yahtml-menu-map))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
225 (setq yahtml-menu-map (make-sparse-keymap "yahtml menu"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
226 (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
227 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
228 yahtml-menu-map-sectioning
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
229 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
230 '((1 "H1" . (lambda () (interactive) (yahtml-insert-begin-end "H1" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
231 (2 "H2" . (lambda () (interactive) (yahtml-insert-begin-end "H2" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
232 (3 "H3" . (lambda () (interactive) (yahtml-insert-begin-end "H3" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
233 (4 "H4" . (lambda () (interactive) (yahtml-insert-begin-end "H4" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
234 (5 "H5" . (lambda () (interactive) (yahtml-insert-begin-end "H5" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
235 (6 "H6" . (lambda () (interactive) (yahtml-insert-begin-end "H6" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
236 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
237 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
238 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
239 yahtml-menu-map-logical
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
240 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
241 '((em "Embolden" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
242 (lambda () (interactive) (yahtml-insert-tag "EM")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
243 (defn "Define a word" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
244 (lambda () (interactive) (yahtml-insert-tag "DEFN")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
245 (cite "Citation" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
246 (lambda () (interactive) (yahtml-insert-tag "CITE")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
247 (code "Code" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
248 (lambda () (interactive) (yahtml-insert-tag "CODE")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
249 (kbd "Keyboard" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
250 (lambda () (interactive) (yahtml-insert-tag "KBD")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
251 (samp "Sample display" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
252 (lambda () (interactive) (yahtml-insert-tag "SAMP")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
253 (strong "Strong" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
254 (lambda () (interactive) (yahtml-insert-tag "STRONG")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
255 (VAR "Variable notation" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
256 (lambda () (interactive) (yahtml-insert-tag "VAR")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
257 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
258 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
259 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
260 yahtml-menu-map-typeface
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
261 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
262 '((b "Bold" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
263 (lambda () (interactive) (yahtml-insert-tag "B")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
264 (i "Italic" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
265 (lambda () (interactive) (yahtml-insert-tag "I")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
266 (tt "Typewriter" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
267 (lambda () (interactive) (yahtml-insert-tag "TT")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
268 (u "Underlined" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
269 (lambda () (interactive) (yahtml-insert-tag "U")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
270 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
271 (setq yahtml-menu-map-listing (make-sparse-keymap "listing"))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
272 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
273 yahtml-menu-map-listing
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
274 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
275 '((ul "Unnumbered" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
276 (lambda () (interactive) (yahtml-insert-begin-end "UL" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
277 (ol "Numbered" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
278 (lambda () (interactive) (yahtml-insert-begin-end "OL" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
279 (dl "Description" .
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
280 (lambda () (interactive) (yahtml-insert-begin-end "DL" nil)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
281 )))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
282 (setq yahtml-menu-map-item (make-sparse-keymap "item"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
283 (yahtml-define-menu
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
284 yahtml-menu-map-item
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
285 (nreverse
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
286 '((li "Simple item" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
287 (lambda () (interactive) (yahtml-insert-single "li")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
288 (dt "Define term" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
289 (lambda () (interactive) (yahtml-insert-single "dt")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
290 (dd "Description of term" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
291 (lambda () (interactive) (yahtml-insert-single "dd")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
292 )))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
293 (define-key yahtml-mode-map [menu-bar yahtml]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
294 (cons "yahtml" yahtml-menu-map))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
295 (yahtml-define-menu
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
296 yahtml-menu-map
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
297 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
298 (list
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
299 (cons (list 'sect "Sectioning")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
300 (cons "sectioning" yahtml-menu-map-sectioning))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
301 (cons (list 'list "Listing")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
302 (cons "Listing" yahtml-menu-map-listing))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
303 (cons (list 'item "Item")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
304 (cons "Itemizing" yahtml-menu-map-item));;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
305 (cons (list 'logi "Logical tags")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
306 (cons "logical" yahtml-menu-map-logical))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
307 (cons (list 'type "Typeface tags")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
308 (cons "typeface" yahtml-menu-map-typeface))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
309 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
310 ))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
311
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
312 (defun yahtml-collect-url-history ()
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
313 "Collect urls from global history file."
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
314 (interactive)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
315 (save-excursion
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
316 (set-buffer
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
317 (find-file-noselect (expand-file-name yahtml-url-history-file)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
318 (goto-char (point-min))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
319 (setq yahtml-urls)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
320 (message "Collecting global history...")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
321 (while (re-search-forward "^[A-Za-z]+:" nil t)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
322 (setq yahtml-urls
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
323 (cons (list
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
324 (buffer-substring
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
325 (progn (beginning-of-line) (point))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
326 (progn (skip-chars-forward "^ ") (point))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
327 yahtml-urls)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
328 (message "Collecting global history...Done")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
329
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
330 ;;; ----------- Completion ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
331 (defvar yahtml-last-begend "html")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
332 (defun yahtml-insert-begend (&optional region)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
333 "Insert <cmd> ... </cmd>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
334 (interactive "P")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
335 (let ((cmd (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
336 (format "Environment(default %s): " yahtml-last-begend)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
337 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
338 (bolp (bolp)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
339 (if (string< "" cmd) (setq yahtml-last-begend cmd))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
340 (setq cmd yahtml-last-begend)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
341 (if region
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
342 (let ((beg (region-beginning))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
343 (end (region-end))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
344 (addin (yahtml-addin cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
345 (goto-char end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
346 (insert (format "</%s>%s" cmd (if bolp "\n" "")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
347 (goto-char beg)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
348 (insert (format "<%s%s>%s" cmd addin (if bolp "\n" ""))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
349 (insert (format "<%s%s" cmd (yahtml-addin cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
350 (if bolp (progn (insert (format ">\n</%s>\n" cmd cmd))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
351 (forward-line -1))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
352 (insert ">")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
353 (save-excursion (insert (format "</%s>" cmd)))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
354
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
355 (defun yahtml-insert-begend-region ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
356 "Call yahtml-insert-begend in the region mode."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
357 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
358 (yahtml-insert-begend t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
359
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
360
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
361 (defun yahtml-insert-form (&optional form)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
362 "Insert <FORM option=\"argument\">."
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
363 (interactive)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
364 (or form
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
365 (setq form
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
366 (YaTeX-cplread-with-learning
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
367 "Form: "
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
368 'yahtml-form-table 'yahtml-user-form-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
369 'yahtml-tmp-form-table)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
370 (let ((p (point)) q)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
371 (insert (format "<%s%s>" form (yahtml-addin (downcase form))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
372 ;;(indent-relative-maybe)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
373 (if (cdr (assoc form yahtml-form-table))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
374 (save-excursion (insert (format "</%s>" form))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
375 (if (search-backward "\"\"" p t) (forward-char 1))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
376
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
377 (defun yahtml-addin (form)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
378 "Check add-in function's existence and call it if exists."
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
379 (let ((addin (concat "yahtml:" form)))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
380 (if (and (intern-soft addin) (fboundp (intern-soft addin)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
381 (concat " " (funcall (intern addin)))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
382 "")))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
383
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
384 (defun yahtml:a ()
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
385 "Add-in function for <a>"
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
386 ; (or yahtml-urls (yahtml-collect-url-history))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
387 ; (concat "href=\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
388 ; (completing-read "href: " yahtml-urls)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
389 ; "\"")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
390 (concat "href=\"" (read-file-name "href: " "" nil nil "") "\"")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
391 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
392
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
393 (defun yahtml:img ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
394 "Add-in function for <img>"
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
395 (or yahtml-urls (yahtml-collect-url-history))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
396 (let ((src (read-file-name "src: " "" nil t ""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
397 (alg (completing-read "align: " '(("top") ("middle") ("bottom")))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
398 (concat "src=\"" src "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
399 (if (string< "" alg) (concat " align=\"" alg "\"")))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
400
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
401 (defun yahtml:form ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
402 "Add-in function `form' input format"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
403 (concat
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
404 " method=" (completing-read "Method: " '(("POST") ("GET")) nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
405 " action=\"" (read-string "Action: ") "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
406 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
407
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
408 (defun yahtml:select ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
409 "Add-in function for `select' input format"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
410 (setq yahtml-last-single-cmd "option")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
411 (concat " name=\"" (read-string "name: ") "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
412
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
413 (defvar yahtml-input-types
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
414 '(("text") ("password") ("checkbox") ("radio") ("submit")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
415 ("reset") ("image") ("hidden")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
416
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
417 (defun yahtml:input ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
418 "Add-in function for `input' form"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
419 (let (name type value checked (size "") (maxlength ""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
420 (setq name (read-string "name: ")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
421 type (completing-read "type (default=text): "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
422 yahtml-input-types nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
423 value (read-string "value: "))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
424 (if (string-match "text\\|password\\|^$" type)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
425 (setq size (read-string "size: ")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
426 maxlength (read-string "maxlength: ")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
427 (concat
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
428 "name=\"" name "\""
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
429 (if (string< "" type) (concat " type=\"" type "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
430 (if (string< "" value) (concat " value=\"" value "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
431 (if (string< "" size) (concat " size=\"" size "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
432 (if (string< "" maxlength) (concat " maxlength=\"" maxlength "\""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
433 )))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
434
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
435
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
436 (defun yahtml-insert-begin-end (env &optional region-mode)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
437 "Insert <ENV> \\n </ENV> by calling YaTeX-insert-begin-end."
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
438 (interactive "sEnv: ")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
439 (setq env (funcall (if yahtml-prefer-upcases 'upcase 'downcase) env))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
440 (YaTeX-insert-begin-end env region-mode))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
441
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
442 (defun yahtml-insert-tag (tag)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
443 "Insert <TAG> </TAG> and put cursor inside of them."
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
444 (interactive
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
445 (list
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
446 (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
447 "Tag: "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
448 'yahtml-typeface-table 'yahtml-user-typeface-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
449 'yahtml-tmp-typeface-table)))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
450 (setq tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
451 (insert (format "<%s> " tag))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
452 (save-excursion (insert (format "</%s>" tag))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
453
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
454 (defun yahtml-insert-single (cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
455 "Insert <CMD>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
456 (interactive
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
457 (list (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
458 (format "Command%s: "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
459 (if yahtml-last-single-cmd
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
460 (concat "(default " yahtml-last-single-cmd ")") ""))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
461 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
462 'yahtml-tmp-single-cmd-table)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
463 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
464 (if (string< "" cmd) (setq yahtml-last-single-cmd cmd))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
465 (insert (format "<%s>" yahtml-last-single-cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
466
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
467 ;;; ---------- Jump ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
468 (defun yahtml-on-href-p ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
469 "Check if point is on href clause."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
470 (let ((p (point)) cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
471 (save-excursion
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
472 (or (bobp) (skip-chars-backward "^ \t"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
473 (and (looking-at "href\\s *=\\s *\"?\\([^\"]+\\)\"?")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
474 (< p (match-end 0))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
475 (YaTeX-match-string 1)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
476
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
477 (defun yahtml-goto-corresponding-href (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
478 "Go to corresponding name."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
479 (let ((href (yahtml-on-href-p)) file name)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
480 (if href
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
481 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
482 ((string-match "^http:" href)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
483 (message "Sorry, jump across http is not supported."))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
484 (t (setq file (substring href 0 (string-match "#" href)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
485 (if (string-match "#" href)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
486 (setq name (substring href (1+ (string-match "#" href)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
487 (if (string< "" file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
488 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
489 (if (string-match "/$" file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
490 (setq file (concat file "index.html")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
491 (if other (YaTeX-switch-to-buffer-other-window file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
492 (YaTeX-switch-to-buffer file))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
493 (if name
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
494 (progn (set-mark-command nil) (yahtml-jump-to-name name)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
495 t)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
496
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
497 (defun yahtml-jump-to-name (name)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
498 "Jump to html's named tag."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
499 (setq name (format "name\\s *=\\s *\"?%s\"?" name))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
500 (or (and (re-search-forward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
501 (and (re-search-backward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
502 (message "Named tag `%s' not found" (substring href 1))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
503
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
504 (defun yahtml-on-begend-p (&optional p)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
505 "Check if point is on begend clause."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
506 (let ((p (point)) cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
507 (save-excursion
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
508 (if p (goto-char p))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
509 (if (= (char-after (point)) ?<) (forward-char 1))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
510 (if (and (re-search-backward "<" nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
511 (looking-at
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
512 (concat "<\\(/?" yahtml-command-regexp "\\)\\b"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
513 (condition-case nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
514 (forward-list 1))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
515 (< p (point)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
516 (YaTeX-match-string 1)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
517
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
518 (defun yahtml-goto-corresponding-begend ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
519 (let ((cmd (yahtml-on-begend-p)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
520 (if cmd
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
521 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
522 (if (= (aref cmd 0) ?/) ;on </cmd> line
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
523 (re-search-backward (format "<%s" (substring cmd 1)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
524 (re-search-forward (format "</%s" cmd)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
525 (if (match-beginning 0) (goto-char (match-beginning 0)))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
526
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
527 (defun yahtml-goto-corresponding-* (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
528 "Go to corresponding object."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
529 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
530 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
531 ((yahtml-goto-corresponding-href other))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
532 ((yahtml-goto-corresponding-begend other))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
533 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
534
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
535 (defun yahtml-goto-corresponding-*-other-window ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
536 "Go to corresponding object."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
537 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
538 (yahtml-goto-corresponding-* t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
539
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
540 ;;; ---------- commenting ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
541 (defun yahtml-comment-region (beg end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
542 (interactive "r")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
543 (comment-region beg end nil))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
544
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
545 (defun yahtml-uncomment-region (beg end)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
546 (interactive "r")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
547 (comment-region beg end '(4)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
548
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
549
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
550
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
551 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
552 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
553 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
554
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
555 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
556 ;;hilit19
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
557 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
558 (defvar yahtml-default-face-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
559 '(
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
560 (form black/ivory white/hex-442233 italic)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
561 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
562 (defvar yahtml-hilit-patterns-alist
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
563 '(
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
564 ;; comments
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
565 ("<!--\\s " "-->" comment)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
566 ;; include&exec
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
567 ("<!--#\\(include\\|exec\\)" "-->" include)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
568 ;; string
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
569 (hilit-string-find 39 string)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
570 (yahtml-hilit-region-tag "\\(em\\|strong\\)" bold)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
571 ("</?[uod]l>" 0 decl)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
572 ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
573 ("<a\\s +href" "</a>" crossref)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
574 ("</?\\sw+>" 0 decl)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
575 ("<form" "</form" form)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
576 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
577
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
578 (defun yahtml-hilit-region-tag (tag)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
579 "Return list of start/end point of <TAG> form."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
580 (if (re-search-forward (concat "<" tag ">") nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
581 (let ((m0 (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
582 (skip-chars-forward " \t\n")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
583 (cons (point)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
584 (progn (re-search-forward (concat "</" tag ">") nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
585 (1- (match-beginning 0)))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
586
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
587 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
588 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
589 ((and (featurep 'hilit19) (featurep 'yatex19))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
590 (or (assq 'yahtml-mode hilit-patterns-alist)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
591 (setq hilit-patterns-alist
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
592 (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
593 hilit-patterns-alist)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
594
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
595 (provide 'yahtml)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
596
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
597 ; Local variables:
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
598 ; fill-prefix: ";;; "
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
599 ; paragraph-start: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
600 ; paragraph-separate: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
601 ; End:

yatex.org