annotate yahtml.el @ 611:e87c3271b8fd draft dev

Add "meter" and "progress" completions
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 17 Jul 2023 17:05:45 +0900
parents 157aa7974191
children c4af3ae90537
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
1 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*-
605
38a414d755c1 PDFnative typesetter
HIROSE Yuuji <yuuji@gentei.org>
parents: 598
diff changeset
2 ;;; (c) 1994-2022 by HIROSE Yuuji [yuuji(@)yatex.org]
366
HIROSE Yuuji <yuuji@gentei.org>
parents: 364
diff changeset
3 ;;; $Id$
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
4
607
157aa7974191 Release preparation for 1.83
HIROSE Yuuji <yuuji@gentei.org>
parents: 605
diff changeset
5 (defconst yahtml-revision-number "1.83"
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
6 "Revision number of running yahtml.el")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
7
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
8 ;;; Commentary:
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
9
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
10 ;;;[Installation]
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
11 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
12 ;;; First, you have to install YaTeX and make sure it works fine. Then
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
13 ;;; put these expressions into your ~/.emacs
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
14 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
15 ;;; (setq auto-mode-alist
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
16 ;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
17 ;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
115
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
18 ;;; (setq yahtml-www-browser "firefox")
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
19 ;;; ;Write your favorite browser. But firefox is advantageous.
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
20 ;;; (setq yahtml-path-url-alist
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
21 ;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
22 ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
23 ;;; ;Write correspondence alist from ABSOLUTE unix path name to URL path.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
24 ;;;
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
25 ;;;[インストール方法]
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
26 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
27 ;;; yahtml.el, yatexlib.el, yatexprc.el を load-path の通ったディレクト
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
28 ;;; リにインストールしてください。その後、以下を参考に ~/.emacs に設定を
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
29 ;;; 追加して下さい。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
30 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
31 ;;; (setq auto-mode-alist
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
32 ;;; (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
33 ;;; (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
115
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
34 ;;; (setq yahtml-www-browser "firefox")
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
35 ;;; ;お気に入りのブラウザを書いて下さい。firefoxが便利です。
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
36 ;;; (setq yahtml-path-url-alist
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
37 ;;; '(("/home/yuuji/public_html" . "http://www.mynet/~yuuji")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
38 ;;; ("/home/staff/yuuji/html" . "http://www.othernet/~yuuji")))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
39 ;;; ;UNIXの絶対パスと対応するURLのリストを書いて下さい。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
40 ;;;
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
41 ;;; HTMLファイル漢字コードが正しく判別されるようにホームディレクトリに
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
42 ;;; .htaccess ファイルを作り以下のどれか1行を選んで書いて下さい。
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
43 ;;;
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
44 ;;; AddType "text/html; charset=Shift_JIS" .html (SJISの場合)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
45 ;;; AddType "text/html; charset=iso2022-jp" .html (JISの場合)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
46 ;;; AddType "text/html; charset=EUC-JP" .html (EUCの場合)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
47 ;;; AddType "text/html; charset=utf-8" .html (UTF-8の場合)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
48 ;;;
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
49 ;;; .htaccess が作れない場合は
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
50 ;;; (setq yahtml-kanji-code 2)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
51 ;;; ;HTMLファイルの漢字コードを変更する場合は
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
52 ;;; ;1=SJIS、2=JIS、3=EUC 4=UTF-8
477
31864e5830fe Default value of yahtml-kanji-code changed to 4(utf-8).
HIROSE Yuuji <yuuji@gentei.org>
parents: 475
diff changeset
53 ;;; ;で設定して下さい。デフォルトは 4 です。
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
54 ;;;
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
55 ;;; を適切に書き換えて ~/.emacs に足して下さい。
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
56 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
57 ;;;[Commentary]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
58 ;;;
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
59 ;;; It is assumed you are already familiar with YaTeX. The following
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
60 ;;; 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
61 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
62 ;;; * [prefix] b X Complete environments such as `H1' which
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
63 ;;; normally requires closing tag `</H1>
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
64 ;;; <a href=foo> ... </a> is also classified into
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
65 ;;; this group
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
66 ;;; When input `href=...', you can complete file
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
67 ;;; name or label(href="#foo") by typing TAB.
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
68 ;;; * [prefix] l Complete typeface-changing commands such as
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
69 ;;; `<i> ... </i>' or `<samp> ... </samp>'
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
70 ;;; This completion can be used to make in-line
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
71 ;;; tags which is normally completed with [prefix] b.
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
72 ;;; * [prefix] s Complete declarative notations such as
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
73 ;;; `<img src="foo.gif">'
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
74 ;;; `<input name="var" ...>'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
75 ;;; * [prefix] m Complete single commands such as
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
76 ;;; `<br>' or `<hr> or <li>...'
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
77 ;;; * [prefix] p Insert <p></p> on the point
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
78 ;;; * M-RET Intelligent newline; if current TAG is one of
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
79 ;;; ul, ol, or dl. insert newline and <li> or
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
80 ;;; <dt> or <dd> suitable for current condition.
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
81 ;;; * menu-bar yahtml Complete all by selecting a menu item (Though I
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
82 ;;; hate menu, this is most useful)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
83 ;;; * [prefix] g Goto corresponding Tag or HREF such as
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
84 ;;; <dl> <-> </dl> or href="xxx".
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
85 ;;; Or invoke image viewer if point is on <img src=...>.
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
86 ;;; * [prefix] k Kill html tags on the point. If you provide
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
87 ;;; universal-argument, kill surrounded contents too.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
88 ;;; * [prefix] c Change html tags on the point.
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
89 ;;; When typeing [prefix] c on `href="xxx"', you can
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
90 ;;; change the reference link with completion.
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
91 ;;; * [prefix] t j Call weblint on current file.
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
92 ;;; * [prefix] t p View current html with WWW browser
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
93 ;;; (To activate this, never fail to set the lisp
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
94 ;;; variable yahtml-www-browser. Recommended value
115
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
95 ;;; is "firefox")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
96 ;;; * [prefix] a YaTeX's accent mark's equivalent of yahtml.
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
97 ;;; This function can input $lt, $gt or so.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
98 ;;; * [prefix] ; Translate chars of `>', `<', `&', and `"' to
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
99 ;;; `&gt;', `&lt;', `&amp;', `&quot;' respectively
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
100 ;;; in the region.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
101 ;;; * [prefix] : Do translation opposite to above, in the region.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
102 ;;; * [prefix] # Translate unsafe-chars and unreserved-chars to
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
103 ;;; URLencoded string in the region.
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
104 ;;;
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
105 ;;;[キーの説明]
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
106 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
107 ;;; 以下の説明において、特にカスタマイズをしていない限り、[prefix] は
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
108 ;;; C-c キーを意味します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
109 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
110 ;;; * [prefix] b X `</H1>' といった終了タグが必要となる`H1'のよう
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
111 ;;; な環境を補完入力します。<a href=foo> ... </a>
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
112 ;;; もこのグループです。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
113 ;;; `href=...' と入力した後、TABキーを押すことで、
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
114 ;;; ファイル名や (href="#foo") のようなラベルも補完
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
115 ;;; できます。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
116 ;;; * [prefix] s 以下のような宣言の補完を行います。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
117 ;;; `<img src="foo.gif">'
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
118 ;;; `<input name="var" ...>'
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
119 ;;; * [prefix] l `<i> ... </i>' や `<samp> ... </samp>' のよう
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
120 ;;; なテキストスタイル指定のタグを補完します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
121 ;;; この補完機能は通常 [prefix] b で補完できるものを
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
122 ;;; 一行内で書きたいときにも用いることが出来ます。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
123 ;;; * [prefix] m `<br>' や `<hr> '、`<li>' 等の単体タグの補完
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
124 ;;; を行います。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
125 ;;; * [prefix] p カーソル位置に<p></p>を挿入します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
126 ;;; * M-RET おまかせ改行; もしul、ol、dl等のタグ(リスト)を
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
127 ;;; 使っている場合に、環境に合わせて改行と <li>、
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
128 ;;; <dt>、<dd>を入力します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
129 ;;; * menu-bar yahtml 選択したアイテムをメニューより補完できます。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
130 ;;; (私はメニューが嫌いなんですが、htmlに関してはメ
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
131 ;;; ニューは一番ありがたいかも)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
132 ;;; * [prefix] g 対応するタグ、<dl> <-> </dl> や href="xxx" の
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
133 ;;; ような TAG にジャンプします。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
134 ;;; <img src=...> の場合はイメージビューワを呼び出
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
135 ;;; します。href=hoge.html の場合はhoge.htmlに飛びま
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
136 ;;; す。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
137 ;;; * [prefix] k ポイント上の HTML タグを消去します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
138 ;;; もし universal-argument を付けた場合(C-uを先に押
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
139 ;;; す)HTMLタグで囲まれた内容も同時に消去します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
140 ;;; * [prefix] c ポイント上のタグを変更します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
141 ;;; `href="xxx"'の上で [prefix] c を利用した場合は、
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
142 ;;; 参照しているリンクを補完機能を使いながら変更で
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
143 ;;; きます。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
144 ;;; * [prefix] t j カレントファイルに対して jweblint を呼び出しま
160
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
145 ;;; す。ファイル先頭付近に
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
146 ;;; <!-- #lint コマンド -->
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
147 ;;; と書いておくとそのコマンドを呼びます。
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
148 ;;; * [prefix] t p WWW ブラウザでカレントファイルを表示します。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
149 ;;; (lisp変数 yahtml-www-browser の設定をお忘れな
115
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
150 ;;; く。お推めは "firefox" です)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
151 ;;; * [prefix] a YaTeX のアクセント記号補完と同じです。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
152 ;;; &lt; &gt; 等が入力できます。
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
153 ;;; * [prefix] ; 指定したリジョン中の > < & " をそれぞれ
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
154 ;;; &gt; &lt; &amp; &quot; に変換します。
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
155 ;;; * [prefix] : 指定したリジョン中で上と逆の変換をします。
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
156 ;;; * [prefix] # 指定したリジョン中で%エンコードの必要な文字が
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
157 ;;; あればそれらをエンコードします。
160
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
158 ;;; * [prefix] } リジョン内の特定文字区切りのレコードを <td> 並びに
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
159 ;;; 変換します。C-u (universal-argument) 付きで起動
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
160 ;;; するとtd以外の任意要素で括ります。thdを指定する
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
161 ;;; と最初の1つだけth,残りすべてをtdで括ります。
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
162 ;;; * [prefix] ] リジョン内のすべての行をフィールドごとにtdで括り,
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
163 ;;; さらに各行をtrで括ります。universal-argument を
b6b5bc017146 Update manual part of file.
yuuji@gentei.org
parents: 159
diff changeset
164 ;;; 付けるとフィールド括りをtd以外に指定できます。
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
165 ;;; * [prefix] ESC yahtml-mode を抜け yahtml-mode に入る前に動作し
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
166 ;;; ていたメジャーモードに戻ります。
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
167 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
168 ;;; [謝辞]
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
169 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
170 ;;; fj野鳥の会の皆さんには貴重な助言を頂きました。また、下に示す方々には
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
171 ;;; 特に大きな協力を頂きました。あわせてここに感謝申し上げます。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
172 ;;;
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
173 ;;; * 横田和也さん(マツダ)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
174 ;;; マニュアルの和訳をして頂きました。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
175 ;;; * 吉田尚志さん(NTT Data)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
176 ;;; Mule for Win32 での動作のさせ方を教えて頂きました。
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
177 ;;; (というかほとんどやってもらった ^^;)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
178 ;;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
179
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
180 ;;; Code:
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
181
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
182 (require 'yatexlib)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
183 ;;; --- customizable variable starts here ---
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
184 (defvar yahtml-prefix "\C-c"
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
185 "*Prefix key stroke of yahtml functions.")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
186 (defvar yahtml-image-viewer "display" "*Image viewer program")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
187 (defvar yahtml-www-browser "firefox" "*WWW Browser command")
477
31864e5830fe Default value of yahtml-kanji-code changed to 4(utf-8).
HIROSE Yuuji <yuuji@gentei.org>
parents: 475
diff changeset
188 (defvar yahtml-kanji-code 4
88
ce2deaceb818 yatex-1.74
yuuji@gentei.org
parents: 86
diff changeset
189 "*Kanji coding system number of html file; 1=sjis, 2=jis, 3=euc, 4=UTF-8")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
190 ;;(defvar yahtml-coding-system
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
191 ;; (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
192 ;; "Kanji coding system")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
193 (and (featurep 'mule)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
194 (integerp yahtml-kanji-code)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
195 (setq yahtml-kanji-code
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
196 (cdr (assq yahtml-kanji-code YaTeX-kanji-code-alist))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
197
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
198 (defvar yahtml-fill-column 72 "*fill culumn used for yahtml-mode")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
199 (defvar yahtml-fill-prefix nil "*fill prefix for yahtml-mode")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
200
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
201 ;;(defvar yahtml-www-server "www" "*Host name of your domain's WWW server")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
202 (defvar yahtml-path-url-alist nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
203 "*Alist of unix path name vs. URL name of WWW server.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
204 Ex.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
205 '((\"/usr/home/yuuji/http\" . \"http://www.comp.ae.keio.ac.jp/~yuuji\")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
206 (\"/home/yuuji/http\" . \"http://www.gentei.org/~yuuji\"))")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
207 (defvar yahtml-directory-index "index.html"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
208 "*Directory index file name;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
209 Consult your site's WWW administrator.")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
210
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
211 (defvar yahtml-environment-indent 1
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
212 "*Indentation depth of HTML's listing environment")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
213
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
214 ;; YaTeX-japan is defined in yatexlib.el
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
215 (defvar yahtml-lint-program (if YaTeX-japan "jweblint" "weblint")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
216 "*Program name to lint HTML file")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
217 (defvar yahtml-hate-too-deep-indentation nil
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
218 "*Non-nil for this variable suppress deep indentation in listing environments.")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
219
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
220 (defvar yahtml-always-/p t
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
221 "*Those who always use <p> with </p> set this to t.")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
222 (defvar yahtml-always-/li nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
223 "*Those who always use <li> with </li> set this to t.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
224 (defvar yahtml-always-/dt nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
225 "*Those who always use <dt> with </dt> set this to t.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
226 (defvar yahtml-always-/dd nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
227 "*Those who always use <dd> with </dd> set this to t.")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
228
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
229 (defvar yahtml-p-prefered-env-regexp "^\\(body\\|dl\\|blockquote\\)"
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
230 "*Regexp of envs where paragraphed sentences are prefered.")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
231
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
232 (defvar yahtml-template-file "~/public_html/template.html"
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
233 "*Template HTML file. It'll be inserted to empty file.")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
234
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
235 (defvar yahtml-prefer-upcases nil
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
236 "*Non-nil for preferring upcase TAGs")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
237
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
238 (defvar yahtml-prefer-upcase-attributes nil
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
239 "*Non-nil for preferring upcase attributes")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
240
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
241 (defvar yahtml-server-type 'apache "*WWW server program type")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
242
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
243 (defvar yahtml-apache-access-file ".htaccess"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
244 "*Server access file name for apache")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
245
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
246 (defvar yahtml-use-css t "*Use stylesheet or not")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
247
161
52e56e399894 yahtml-image-inspection-bytes=500000
yuuji@gentei.org
parents: 160
diff changeset
248 (defvar yahtml-image-inspection-bytes 500000
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
249 "*Number of bytes to inspect the image for geometry information")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
250 (defvar yahtml:img-default-alt-format "%xx%y(%sbytes)"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
251 "*Default format of img entity's ALT attributes.
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
252 %x: width, %y: height, %s: size in bytes, %c: first comment string,
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
253 %f: filename")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
254
203
ee74177831b4 Oops, yahtml-faithful-to-htmllint is not negative of yahtml-always/li. Fixed.
yuuji@gentei.org
parents: 200
diff changeset
255 (defvar yahtml-faithful-to-htmllint yahtml-always-/li
190
3db120d6b7d1 Calculation of indentation depth revised. (included again after merge conflict)
yuuji@gentei.org
parents: 189
diff changeset
256 "*Non-nil doesn't put space after opening tags.")
3db120d6b7d1 Calculation of indentation depth revised. (included again after merge conflict)
yuuji@gentei.org
parents: 189
diff changeset
257
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
258 (defvar yahtml-error-line-regexp
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
259 "^\\(.*\\)(\\([0-9]+\\)):\\|^line \\([0-9]+\\)"
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
260 "*Regexp of error position which is produced by lint program.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
261
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
262 (defvar yahtml-translate-hyphens-when-comment-region t
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
263 "*Non-nil for translate hyphens to &#45; when comment-region")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
264 (defvar yahtml-escape-chars 'ask
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
265 "*Escape reserved characters to URL-encoding or not.
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
266 Nil for never, t for everytime, and 'ask for inquiring
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
267 at each reserved chars.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
268
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
269 (defvar yahtml-use-font-lock (and (featurep 'font-lock)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
270 (fboundp 'font-lock-fontify-region))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
271 "*Non-nil means to use font-lock to fontify buffer.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
272
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
273 (defvar yahtml-use-hilit19 (and (featurep 'hilit19)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
274 (not yahtml-use-font-lock))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
275 "*Non-nil means to Use hilit19 to highlight buffer")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
276
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
277 (defvar yahtml-mode-abbrev-table nil
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
278 "*Abbrev table in use in yahtml-mode buffers.")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
279 (define-abbrev-table 'yahtml-mode-abbrev-table ())
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
280
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
281 (defvar yahtml-indentation-boundary "^\\s *<h[1-3]>"
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
282 "*Boundary regexp for indentation calculation.")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
283
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
284 (defvar yahtml-html4-strict t
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
285 "*Non-nil means editing HTML 4.01 Strict.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
286 Completing read for obsoleted attributes disabled.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
287
409
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
288 (defvar yahtml-electric-indent-mode -1
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
289 "*(Emacs 24.4+) Pass this value to electric-indent-local-mode.
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
290 -1 means `off'.")
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
291
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
292 ;;; --- customizable variable ends here ---
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
293 (defvar yahtml-prefix-map nil)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
294 (defvar yahtml-mode-map nil "Keymap used in yahtml-mode.")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
295 (defvar yahtml-lint-buffer-map nil "Keymap used in lint buffer.")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
296 (defvar yahtml-shell-command-option
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
297 (or (and (boundp 'shell-command-option) shell-command-option)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
298 (if (eq system-type 'ms-dos) "/c" "-c")))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
299 (defvar yahtml-use-highlighting (or yahtml-use-font-lock yahtml-use-hilit19))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
300
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
301 (defun yahtml-define-begend-key-normal (key env &optional map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
302 "Define short cut yahtml-insert-begend key."
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
303 (YaTeX-define-key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
304 key
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
305 (list 'lambda '(arg) '(interactive "P")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
306 (list 'yahtml-insert-begend 'arg env))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
307 map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
308
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
309 (defun yahtml-define-begend-region-key (key env &optional map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
310 "Define short cut yahtml-insert-begend-region key."
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
311 (YaTeX-define-key key (list 'lambda nil '(interactive)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
312 (list 'yahtml-insert-begend t env)) map))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
313
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
314 (defun yahtml-define-begend-key (key env &optional map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
315 "Define short cut key for begin type completion both for
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
316 normal and region mode. To customize yahtml, user should use this function."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
317 (yahtml-define-begend-key-normal key env map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
318 (if YaTeX-inhibit-prefix-letter nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
319 (yahtml-define-begend-region-key
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
320 (concat (upcase (substring key 0 1)) (substring key 1)) env map)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
321
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
322 (if yahtml-mode-map nil
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
323 (setq yahtml-mode-map (make-sparse-keymap)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
324 yahtml-prefix-map (make-sparse-keymap))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
325 (define-key yahtml-mode-map yahtml-prefix yahtml-prefix-map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
326 (define-key yahtml-mode-map "\M-\C-@" 'yahtml-mark-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
327 (if (and (boundp 'window-system) (eq window-system 'x) YaTeX-emacs-19)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
328 (define-key yahtml-mode-map [?\M-\C- ] 'yahtml-mark-begend))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
329 (define-key yahtml-mode-map "\M-\C-a" 'YaTeX-beginning-of-environment)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
330 (define-key yahtml-mode-map "\M-\C-e" 'YaTeX-end-of-environment)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
331 (define-key yahtml-mode-map "\M-\C-m" 'yahtml-intelligent-newline)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
332 (define-key yahtml-mode-map "\M-\C-j" 'yahtml-intelligent-newline)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
333 (define-key yahtml-mode-map "\C-i" 'yahtml-indent-line)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
334 (define-key yahtml-mode-map "&" 'yahtml-insert-amps)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
335 (let ((map yahtml-prefix-map))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
336 (YaTeX-define-key "^" 'yahtml-visit-main map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
337 (YaTeX-define-key "4^" 'yahtml-visit-main-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
338 (YaTeX-define-key "4g" 'yahtml-goto-corresponding-*-other-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
339 (YaTeX-define-key "44" 'YaTeX-switch-to-window map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
340 (and YaTeX-emacs-19 window-system
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
341 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
342 (YaTeX-define-key "5^" 'yahtml-visit-main-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
343 (YaTeX-define-key "5g" 'yahtml-goto-corresponding-*-other-frame map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
344 (YaTeX-define-key "55" 'YaTeX-switch-to-window map)))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
345 (YaTeX-define-key "v" 'yahtml-version map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
346 (YaTeX-define-key "s" 'yahtml-insert-form map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
347 (YaTeX-define-key "l" 'yahtml-insert-tag map)
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
348 (YaTeX-define-key "L" 'yahtml-insert-tag-region map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
349 (YaTeX-define-key "m" 'yahtml-insert-single map)
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
350 (YaTeX-define-key "n" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "<BR>" "<br>")))) map)
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
351 (YaTeX-define-key "-" (function(lambda () (interactive) (insert (if yahtml-prefer-upcases "<HR>" "<hr>") "\n"))) map)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
352 (YaTeX-define-key "p" 'yahtml-insert-p map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
353 (if YaTeX-no-begend-shortcut
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
354 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
355 (YaTeX-define-key "B" 'yahtml-insert-begend-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
356 (YaTeX-define-key "b" 'yahtml-insert-begend map))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
357 (yahtml-define-begend-key "bh" "html" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
358 (yahtml-define-begend-key "bH" "head" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
359 (yahtml-define-begend-key "bt" "title" map)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
360 (yahtml-define-begend-key "bT" "table" map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
361 (yahtml-define-begend-key "bb" "body" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
362 (yahtml-define-begend-key "bc" "center" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
363 (yahtml-define-begend-key "bd" "dl" map)
568
be050eec7849 Short-cut of yahtml: bD -> div
HIROSE Yuuji <yuuji@gentei.org>
parents: 550
diff changeset
364 (yahtml-define-begend-key "bD" "div" map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
365 (yahtml-define-begend-key "bu" "ul" map)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
366 (yahtml-define-begend-key "bo" "ol" map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
367 (yahtml-define-begend-key "b1" "h1" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
368 (yahtml-define-begend-key "b2" "h2" map)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
369 (yahtml-define-begend-key "b3" "h3" map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
370 (yahtml-define-begend-key "ba" "a" map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
371 (yahtml-define-begend-key "bf" "form" map)
428
9219b8c610f8 "label"
HIROSE Yuuji <yuuji@gentei.org>
parents: 411
diff changeset
372 (yahtml-define-begend-key "bl" "label" map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
373 (yahtml-define-begend-key "bs" "select" map)
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
374 (yahtml-define-begend-key "bv" "div" map)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
375 (yahtml-define-begend-key "bS" "span" map)
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
376 (yahtml-define-begend-key "bp" "pre" map)
569
e3209b30680c [prefix] bq produces <blockquote></blockquote>
HIROSE Yuuji <yuuji@gentei.org>
parents: 568
diff changeset
377 (yahtml-define-begend-key "bq" "blockquote" map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
378 (YaTeX-define-key "b " 'yahtml-insert-begend map)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
379 (YaTeX-define-key "B " 'yahtml-insert-begend-region map))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
380 (YaTeX-define-key "e" 'YaTeX-end-environment map)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
381 (YaTeX-define-key ">" 'yahtml-comment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
382 (YaTeX-define-key "<" 'yahtml-uncomment-region map)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
383 (YaTeX-define-key "g" 'yahtml-goto-corresponding-* map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
384 (YaTeX-define-key "k" 'yahtml-kill-* map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
385 (YaTeX-define-key "c" 'yahtml-change-* map)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
386 (YaTeX-define-key "t" 'yahtml-browse-menu map)
432
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
387 (YaTeX-define-key "a" 'yahtml-char-entity-ref map)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
388 (YaTeX-define-key "'" 'yahtml-prev-error map)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
389 (YaTeX-define-key ";" 'yahtml-translate-region map)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
390 (YaTeX-define-key ":" 'yahtml-translate-reverse-region map)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
391 (YaTeX-define-key "#" 'yahtml-escape-chars-region map)
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
392 (YaTeX-define-key "}" 'yahtml-td-region map)
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
393 (YaTeX-define-key "]" 'yahtml-tr-region map)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
394 ;;;;;(YaTeX-define-key "i" 'yahtml-fill-item map)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
395 (YaTeX-define-key "\e" 'yahtml-quit map))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
396 (substitute-all-key-definition
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
397 'fill-paragraph 'yahtml-fill-paragraph yahtml-mode-map)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
398 (substitute-all-key-definition
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
399 'kill-buffer 'YaTeX-kill-buffer yahtml-mode-map))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
400
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
401 (if yahtml-lint-buffer-map nil
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
402 (setq yahtml-lint-buffer-map (make-keymap))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
403 (define-key yahtml-lint-buffer-map " " 'yahtml-jump-to-error-line))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
404
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
405
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
406 (defvar yahtml-paragraph-start
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
407 (concat
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
408 "^$\\|<!--\\|^[ \t]*</?\\(h[1-6]\\|p\\|d[ldt]\\|[bhtd][rdh]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\|table\\|center\\|blockquote\\)\\b")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
409 "*Regexp of html paragraph separater")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
410 (defvar yahtml-paragraph-separate
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
411 (concat
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
412 "^$\\|<!--\\|^[ \t]*</?\\(h[1-6]\\|p\\|[bhtd][ldt]\\|li\\|body\\|html\\|head\\|title\\|ul\\|ol\\|dl\\|pre\\|table\\|center\\|blockquote\\|!--\\)\\b")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
413 "*Regexp of html paragraph separater")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
414 (defvar yahtml-syntax-table nil
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
415 "*Syntax table for yahtml-mode")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
416
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
417 (if yahtml-syntax-table nil
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
418 (setq yahtml-syntax-table
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
419 (make-syntax-table (standard-syntax-table)))
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
420 (modify-syntax-entry ?\< "(>" yahtml-syntax-table)
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
421 (modify-syntax-entry ?\> ")<" yahtml-syntax-table)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
422 (modify-syntax-entry ?\n " " yahtml-syntax-table))
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
423
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
424 (defvar yahtml-command-regexp "[A-Za-z0-9]+"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
425 "Regexp of constituent of html commands.")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
426
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
427 ;;; Completion tables for `form'
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
428 (defvar yahtml-form-table
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
429 '(("img") ("input") ("link") ("meta") ("label") ("source")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
430 (defvar yahtml-user-form-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
431 (defvar yahtml-tmp-form-table nil)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
432 (defvar yahtml-last-form "img")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
433
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
434 (defvar yahtml-env-table
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
435 '(("html") ("head") ("title") ("body") ("dl") ("ul") ("ol") ("pre")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
436 ("a") ("form") ("select") ("center") ("textarea") ("blockquote")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
437 ("OrderedList" . "ol")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
438 ("UnorderedList" . "ul")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
439 ("DefinitionList" . "dl")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
440 ("Preformatted" . "pre")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
441 ("table") ("thead") ("tbody") ("tfoot") ("tr") ("th") ("td")
136
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
442 ("address") ("button")
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
443 ("h1") ("h2") ("h3") ("h4") ("h5") ("h6")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
444 ;; ("p") ;This makes indentation screwed up!
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
445 ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del")
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
446 ("option") ("datalist")
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
447 ;;HTML5
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
448 ("video") ("audio") ("figure") ("iframe")
583
d4831b3672f8 Add some html5 elements
HIROSE Yuuji <yuuji@gentei.org>
parents: 573
diff changeset
449 ("header") ("footer") ("article") ("section") ("nav") ("main") ("aside")
611
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
450 ("meter") ("progress")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
451 ))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
452
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
453 (if yahtml-html4-strict
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
454 (setq yahtml-env-table
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
455 (delete (assoc "center" yahtml-env-table) yahtml-env-table)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
456
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
457 ;(defvar yahtml-itemizing-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
458 ; "\\(ul\\|ol\\|dl\\)"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
459 ; "Regexp of itemizing forms")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
460
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
461 (defvar yahtml-user-env-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
462 (defvar yahtml-tmp-env-table nil)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
463
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
464 ;;; Completion tables for typeface designator
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
465 (and yahtml-always-/p
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
466 (or (assoc "p" yahtml-env-table)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
467 (setq yahtml-env-table (cons '("p") yahtml-env-table))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
468 (and yahtml-always-/li
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
469 (or (assoc "li" yahtml-env-table)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
470 (setq yahtml-env-table (cons '("li") yahtml-env-table))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
471 (and yahtml-always-/dt
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
472 (or (assoc "dt" yahtml-env-table)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
473 (setq yahtml-env-table (cons '("dt") yahtml-env-table))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
474 (and yahtml-always-/dd
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
475 (or (assoc "dd" yahtml-env-table)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
476 (setq yahtml-env-table (cons '("dd") yahtml-env-table))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
477
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
478 (defvar yahtml-typeface-table
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
479 (append
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
480 '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("caption")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
481 ("strong") ("var") ("b") ("i") ("tt") ("big") ("small")
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
482 ("sup") ("sub") ("span") ("abbr") ("label")
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
483 ;; HTML5
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
484 ("figcaption")
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
485 )
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
486 (if (not yahtml-html4-strict)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
487 '(("strike") ("s") ("u") ("font")))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
488 yahtml-env-table)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
489 "Default completion table of typeface designator")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
490 (defvar yahtml-user-typeface-table nil)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
491 (defvar yahtml-tmp-typeface-table nil)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
492 (defvar yahtml-last-typeface-cmd "a")
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
493
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
494 (defvar yahtml-single-cmd-table
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
495 '(("hr") ("br") ("option")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
496 ("HorizontalRule" . "hr")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
497 ("BreakLine" . "br")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
498 ("exec" . "!--#exec")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
499 ("!--#exec")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
500 ("include" . "!--#include")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
501 ("!--#include")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
502 ;; ("Item" . "li")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
503 ;; ("DefineTerm" . "dt")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
504 ;; ("Description" . "dd")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
505 ;; ("dd") ("dt") ("li")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
506 )
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
507 "Default completion table of HTML single command.")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
508 (defvar yahtml-user-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
509 (defvar yahtml-tmp-single-cmd-table nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
510 (defvar yahtml-last-single-cmd nil)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
511
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
512 (defvar yahtml-current-completion-type nil
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
513 "Has current completion type. This may be used in yahtml addin functions.")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
514
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
515 (defvar yahtml-struct-name-regexp
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
516 (concat
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
517 "\\<\\("
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
518 ;(mapconcat 'car yahtml-typeface-table "\\|")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
519 (mapconcat 'car yahtml-env-table "\\|")
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
520 "\\)\\b")
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
521 "Regexp of structure beginning.")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
522
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
523 (defvar yahtml-closable-regexp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
524 (concat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
525 "\\<\\("
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
526 (mapconcat 'car yahtml-typeface-table "\\|")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
527 (mapconcat 'car yahtml-env-table "\\|")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
528 "\\)\\b")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
529 "Regexp of any closable elemnts.")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
530
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
531 (defvar yahtml-indent-listing-constant t
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
532 "*Nil means indentation for listing obeys the column of `>'.
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
533 T for static indentation depth")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
534
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
535 (or (assoc "p" yahtml-env-table)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
536 (setq yahtml-env-table (cons '("p") yahtml-env-table)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
537
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
538
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
539 (defun yahtml-get-user-httpconf-entry (regexp)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
540 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
541 ((and (eq yahtml-server-type 'apache) ;;check .htaccess
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
542 buffer-file-name)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
543 (let ((dir default-directory)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
544 charset af ext (ldir "")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
545 line
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
546 (case-fold-search t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
547 (uid (car (cdr (cdr (file-attributes "."))))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
548 (if (string-match "^[A-Z]:" dir)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
549 (setq dir (substring dir 2))) ;remove drive letter
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
550 (while (and dir
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
551 (not (string= dir ldir))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
552 (equal uid (car (cdr (cdr (file-attributes dir))))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
553 (setq af (expand-file-name yahtml-apache-access-file dir))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
554 (if (file-exists-p af)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
555 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
556 (set-buffer (find-file-noselect af))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
557 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
558 (goto-char (point-min))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
559 (if (re-search-forward regexp nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
560 (setq line (buffer-substring
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
561 (point-beginning-of-line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
562 (point-end-of-line))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
563 dir nil)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
564 (kill-buffer (current-buffer))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
565 (if dir
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
566 (setq ldir dir
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
567 dir (substring dir 0 (string-match "/$" dir))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
568 dir (file-name-directory dir))))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
569 line))
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
570 (t nil)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
571
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
572 (defun yahtml-dir-default-charset ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
573 (let*((fn (file-name-nondirectory (or buffer-file-name "")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
574 (ext (substring fn (or (string-match "\\.[a-z0-9]+$" fn) 0)))
435
8a9ef7c96a0a Consider multiple extensions in .htaccess/AddType Line.
HIROSE Yuuji <yuuji@gentei.org>
parents: 432
diff changeset
575 (ptn (format "^\\s *AddType.*charset=\\(.*\\)\\%s\\>" ext))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
576 (case-fold-search t)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
577 line
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
578 charset)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
579 (if (setq line (yahtml-get-user-httpconf-entry ptn))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
580 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
581 (string-match ptn line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
582 (setq charset
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
583 (substring line (match-beginning 1) (match-end 1)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
584 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
585 ((string-match "iso-2022-jp" charset)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
586 (setq charset 2))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
587 ((string-match "euc-jp" charset)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
588 (setq charset 3))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
589 ((string-match "shift_jis" charset)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
590 (setq charset 1))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
591 ((string-match "utf-8" charset)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
592 (setq charset 4))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
593 (t (setq charset nil)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
594 (setq dir "")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
595 (if (featurep 'mule)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
596 (setq charset (cdr (assq charset YaTeX-kanji-code-alist))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
597 charset))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
598
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
599 (defun yahtml-get-directory-index ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
600 (let ((line (yahtml-get-user-httpconf-entry "^\\s *DirectoryIndex"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
601 x index-list)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
602 ;;s/\\s *$//;
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
603 (if line
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
604 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
605 (if (string-match "DirectoryIndex\\s +\\(.*\\)\\s *$" line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
606 (setq line (substring line (match-beginning 1) (match-end 1))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
607 (while (string< "" line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
608 (if (setq x (string-match "\\(\\s +\\)" line))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
609 (setq index-list (cons (substring line 0 x) index-list)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
610 line (substring line (match-end 1)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
611 (setq index-list (cons line index-list)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
612 line "")))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
613 (or (nreverse index-list)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
614 (if (listp yahtml-directory-index)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
615 yahtml-directory-index
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
616 (list yahtml-directory-index)))))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
617
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
618 (defvar yahtml-mode-old-mode nil)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
619 (defun yahtml-mode ()
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
620 (interactive)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
621 (let ((old-mm major-mode)) ;Emacs21.0.95 resets major-mode
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
622 (kill-all-local-variables) ;with kill-all-local-variables
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
623 (if (not (eq 'yahtml-mode old-mm))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
624 (set (make-local-variable 'yahtml-mode-old-mode) old-mm)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
625 (let ((coding (or (yahtml-dir-default-charset) yahtml-kanji-code)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
626 (cond
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
627 ((null coding) nil)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
628 ((and YaTeX-emacs-20 (boundp 'buffer-file-coding-system))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
629 (setq buffer-file-coding-system
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
630 (or (and (fboundp 'set-auto-coding) buffer-file-name
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
631 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
632 (goto-char (point-min))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
633 (set-auto-coding buffer-file-name (buffer-size))))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
634 coding)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
635 ((featurep 'mule)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
636 (set-file-coding-system coding))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
637 ((boundp 'NEMACS)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
638 (make-local-variable 'kanji-fileio-code)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
639 (setq kanji-fileio-code coding))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
640 (setq major-mode 'yahtml-mode
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
641 mode-name "yahtml"
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
642 YaTeX-current-file-name (file-name-nondirectory
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
643 (or (buffer-file-name) ""))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
644 local-abbrev-table yahtml-mode-abbrev-table)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
645 (mapcar
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
646 (function (lambda (x)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
647 (make-local-variable (car x))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
648 (set (car x) (if (and (symbolp (cdr x))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
649 (boundp (cdr x)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
650 (symbol-value (cdr x))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
651 (cdr x)))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
652 '((YaTeX-ec . "")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
653 (YaTeX-struct-begin . "<%1%2")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
654 (YaTeX-struct-end . "</%1>")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
655 (YaTeX-struct-name-regexp . yahtml-closable-regexp)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
656 (YaTeX-comment-prefix . "<!--[^#]")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
657 (YaTeX-coding-system . yahtml-kanji-code) ;necessary?
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
658 (YaTeX-typesetting-mode-map . yahtml-lint-buffer-map)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
659 (fill-prefix . yahtml-fill-prefix) (fill-column . yahtml-fill-column)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
660 (paragraph-start . yahtml-paragraph-start)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
661 (paragraph-separate . yahtml-paragraph-separate)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
662 (comment-start . "<!-- ") (comment-end . " -->")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
663 (comment-start-skip . comment-start)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
664 (indent-line-function . yahtml-indent-line)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
665
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
666 (if yahtml-use-font-lock
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
667 (progn
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
668 (yahtml-font-lock-set-default-keywords)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
669 (or (featurep 'xemacs)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
670 (progn
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
671 (set (make-local-variable 'font-lock-defaults)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
672 '(yahtml-font-lock-keywords nil t))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
673 ;;(font-lock-mode -1)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
674 (font-lock-mode 1) ;;Why should I fontify again???
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
675 ;; in yatex-mode, there's no need to refontify...
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
676 (font-lock-fontify-buffer)))))
330
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
677 ;; +dnd for X11 w/ emacs23+
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
678 (and window-system (featurep 'dnd)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
679 (set (make-local-variable 'dnd-protocol-alist)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
680 (cons (cons "^\\(file\\|https?\\):" 'yahtml-dnd-handler)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
681 dnd-protocol-alist)))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
682
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
683 (set-syntax-table yahtml-syntax-table)
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents:
diff changeset
684 (use-local-map yahtml-mode-map)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
685 (YaTeX-read-user-completion-table)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
686 (yahtml-css-scan-styles)
409
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
687 ;(turn-on-auto-fill) ;Sorry, this is prerequisite
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
688 (and (= 0 (buffer-size)) (file-exists-p yahtml-template-file)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
689 (y-or-n-p (format "Insert %s?" yahtml-template-file))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
690 (insert-file-contents (expand-file-name yahtml-template-file)))
409
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
691 (if (fboundp 'electric-indent-local-mode)
781604df4cbd New variables: YaTeX-electric-indent-mode, yahtml-electric-indent-mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 396
diff changeset
692 (electric-indent-local-mode yahtml-electric-indent-mode))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
693 (run-hooks 'text-mode-hook 'yahtml-mode-hook)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
694
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
695 ;; This warning should be removed after a while(2000/12/2)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
696 (let ((fld (or (and (local-variable-p 'font-lock-defaults (current-buffer))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
697 font-lock-defaults)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
698 (get 'yahtml-mode 'font-lock-defaults))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
699 (and fld (not (memq 'yahtml-font-lock-keywords fld))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
700 (YaTeX-warning-font-lock "yahtml"))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
701
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
702 (defun yahtml-version ()
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
703 "Return string of the version of running yahtml."
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
704 (interactive)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
705 (message
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
706 (concat "Yet Another HTML-mode "
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
707 (if YaTeX-japan "「HTML屋」" "`yahtml'")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
708 " Revision "
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
709 yahtml-revision-number)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
710
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
711 (defun yahtml-quit ()
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
712 (interactive)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
713 (and yahtml-mode-old-mode
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
714 (fboundp yahtml-mode-old-mode)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
715 (funcall yahtml-mode-old-mode)))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
716
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
717 (defun yahtml-define-menu (keymap bindlist)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
718 (cond
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
719 ((featurep 'xemacs)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
720 (let ((name (keymap-name (symbol-value keymap))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
721 (set keymap nil)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
722 (mapcar
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
723 (function
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
724 (lambda (bind)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
725 (setq bind (cdr bind))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
726 (if (eq (car (cdr bind)) 'lambda)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
727 (setcar (cdr bind) 'progn))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
728 (if (stringp (car (cdr bind)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
729 (set keymap (cons (cdr bind) (symbol-value keymap)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
730 (set keymap (cons (vector (car bind) (cdr bind) t)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
731 (symbol-value keymap))))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
732 bindlist)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
733 (set keymap (cons name (symbol-value keymap)))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
734 (t
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
735 (mapcar
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
736 (function
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
737 (lambda (bind)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
738 (define-key (symbol-value keymap) (vector (car bind)) (cdr bind))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
739 bindlist))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
740
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
741 (defvar yahtml-menu-map nil "Menu map of yahtml")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
742 (defvar yahtml-menu-map-sectioning nil "Menu map of yahtml(sectioning)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
743 (defvar yahtml-menu-map-listing nil "Menu map of yahtml(listing)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
744 (defvar yahtml-menu-map-logical nil "Menu map of yahtml(logical tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
745 (defvar yahtml-menu-map-typeface nil "Menu map of yahtml(typeface tags)")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
746
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
747 ;;; Variables for mosaic url history
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
748 (defvar yahtml-urls nil "Alist of global history")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
749 (defvar yahtml-urls-private nil)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
750 (defvar yahtml-urls-local nil)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
751
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
752 (cond
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
753 ((and YaTeX-emacs-19 (null yahtml-menu-map))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
754 (setq yahtml-menu-map (make-sparse-keymap "yahtml"))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
755 (setq yahtml-menu-map-sectioning (make-sparse-keymap "sectioning menu"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
756 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
757 'yahtml-menu-map-sectioning
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
758 (nreverse
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
759 '((1 "H1" . (lambda () (interactive) (yahtml-insert-begend nil "H1")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
760 (2 "H2" . (lambda () (interactive) (yahtml-insert-begend nil "H2")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
761 (3 "H3" . (lambda () (interactive) (yahtml-insert-begend nil "H3")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
762 (4 "H4" . (lambda () (interactive) (yahtml-insert-begend nil "H4")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
763 (5 "H5" . (lambda () (interactive) (yahtml-insert-begend nil "H5")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
764 (6 "H6" . (lambda () (interactive) (yahtml-insert-begend nil "H6")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
765 )))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
766 (setq yahtml-menu-map-logical (make-sparse-keymap "logical tags"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
767 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
768 'yahtml-menu-map-logical
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
769 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
770 '((em "Embolden" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
771 (lambda () (interactive) (yahtml-insert-tag nil "EM")))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
772 (dfn "Define a word" .
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
773 (lambda () (interactive) (yahtml-insert-tag nil "DFN")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
774 (cite "Citation" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
775 (lambda () (interactive) (yahtml-insert-tag nil "CITE")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
776 (code "Code" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
777 (lambda () (interactive) (yahtml-insert-tag nil "CODE")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
778 (kbd "Keyboard" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
779 (lambda () (interactive) (yahtml-insert-tag nil "KBD")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
780 (samp "Sample display" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
781 (lambda () (interactive) (yahtml-insert-tag nil "SAMP")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
782 (strong "Strong" .
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
783 (lambda () (interactive) (yahtml-insert-tag nil "STRONG")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
784 (VAR "Variable notation" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
785 (lambda () (interactive) (yahtml-insert-tag nil "var"))))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
786 (setq yahtml-menu-map-typeface (make-sparse-keymap "typeface tags"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
787 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
788 'yahtml-menu-map-typeface
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
789 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
790 '((b "Bold" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
791 (lambda () (interactive) (yahtml-insert-tag nil "b")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
792 (i "Italic" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
793 (lambda () (interactive) (yahtml-insert-tag nil "i")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
794 (tt "Typewriter" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
795 (lambda () (interactive) (yahtml-insert-tag nil "tt")))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
796 (u "Underlined" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
797 (lambda () (interactive) (yahtml-insert-tag nil "u"))))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
798 (setq yahtml-menu-map-listing (make-sparse-keymap "listing"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
799 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
800 'yahtml-menu-map-listing
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
801 (nreverse
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
802 '((ul "Unordered" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
803 (lambda () (interactive) (yahtml-insert-begend nil "ul")))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
804 (ol "Ordered" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
805 (lambda () (interactive) (yahtml-insert-begend nil "ol")))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
806 (dl "Definition" .
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
807 (lambda () (interactive) (yahtml-insert-begend nil "dl"))))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
808 (setq yahtml-menu-map-item (make-sparse-keymap "item"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
809 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
810 'yahtml-menu-map-item
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
811 (nreverse
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
812 '((li "Simple item" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
813 (lambda () (interactive) (yahtml-insert-single "li")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
814 (dt "Define term" .
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
815 (lambda () (interactive) (yahtml-insert-single "dt")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
816 (dd "Description of term" .
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
817 (lambda () (interactive) (yahtml-insert-single "dd"))))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
818 (define-key yahtml-mode-map [menu-bar yahtml]
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
819 (cons "yahtml" yahtml-menu-map))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
820 (YaTeX-define-menu
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
821 'yahtml-menu-map
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
822 (nreverse
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
823 (list
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
824 (cons (list 'sect "Sectioning")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
825 (cons "sectioning" yahtml-menu-map-sectioning))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
826 (cons (list 'list "Listing")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
827 (cons "Listing" yahtml-menu-map-listing))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
828 (cons (list 'item "Item")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
829 (cons "Itemizing" yahtml-menu-map-item));;;
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
830 (cons (list 'logi "Logical tags")
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
831 (cons "logical" yahtml-menu-map-logical))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
832 (cons (list 'type "Typeface tags")
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
833 (cons "typeface" yahtml-menu-map-typeface)))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
834 (if (featurep 'xemacs)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
835 (add-hook 'yahtml-mode-hook
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
836 (function
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
837 (lambda ()
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
838 (or (assoc "yahtml" current-menubar)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
839 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
840 (set-buffer-menubar (copy-sequence current-menubar))
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
841 (add-submenu nil yahtml-menu-map)))))))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
842
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
843 ;;; ----------- Completion ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
844 (defvar yahtml-last-begend "html")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
845 (defun yahtml-insert-begend (&optional region env)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
846 "Insert <cmd> ... </cmd>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
847 (interactive "P")
392
c44910b36b95 Switch to region-mode if completion called with active region.
HIROSE Yuuji <yuuji@gentei.org>
parents: 366
diff changeset
848 (setq yahtml-current-completion-type 'multiline
c44910b36b95 Switch to region-mode if completion called with active region.
HIROSE Yuuji <yuuji@gentei.org>
parents: 366
diff changeset
849 region (or region (YaTeX-region-active-p)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
850 (let*((completion-ignore-case t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
851 (cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
852 (or env
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
853 (YaTeX-cplread-with-learning
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
854 (format "Environment(default %s): " yahtml-last-begend)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
855 'yahtml-env-table 'yahtml-user-env-table 'yahtml-tmp-env-table)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
856 (bolp (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
857 (skip-chars-backward " \t" (point-beginning-of-line)) (bolp)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
858 (cc (current-column)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
859 (if (string< "" cmd) (setq yahtml-last-begend cmd))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
860 (setq yahtml-last-begend
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
861 (or (cdr (assoc yahtml-last-begend yahtml-env-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
862 yahtml-last-begend))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
863 (setq cmd yahtml-last-begend)
180
8b8593e02dad Care about lower case.
yuuji@gentei.org
parents: 166
diff changeset
864 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase) cmd))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
865 (if region
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
866 ;; We want to keep region effective for new tagged environment
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
867 ;; to enable continuous regioning by another environment
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
868 (let ((beg (region-beginning))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
869 (end (region-end))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
870 (addin (yahtml-addin cmd)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
871 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
872 (goto-char end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
873 (insert-before-markers (format "</%s>%s" cmd (if bolp "\n" "")))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
874 (goto-char beg)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
875 (insert (format "<%s%s>%s" cmd addin (if bolp "\n" "")))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
876 (insert (format "<%s%s>" cmd (yahtml-addin cmd)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
877 (save-excursion
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
878 (insert "\n")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
879 (indent-to-column cc)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
880 (insert (format "</%s>" cmd)))
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
881 (if (string-match "^[ap]$" cmd) ;aとp決め打ちってのが美しくない…
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
882 (newline)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
883 (yahtml-intelligent-newline nil))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
884 (yahtml-indent-line))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
885
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
886 (defun yahtml-insert-begend-region ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
887 "Call yahtml-insert-begend in the region mode."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
888 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
889 (yahtml-insert-begend t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
890
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
891
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
892 (defun yahtml-insert-form (&optional form)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
893 "Insert <FORM option=\"argument\">."
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
894 (interactive)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
895 (setq yahtml-current-completion-type 'single)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
896 (or form
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
897 (let ((completion-ignore-case t))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
898 (setq form
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
899 (YaTeX-cplread-with-learning
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
900 (format "Form(default %s): " yahtml-last-form)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
901 'yahtml-form-table 'yahtml-user-form-table
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
902 'yahtml-tmp-form-table))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
903 (let ((p (point)) q)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
904 (if (string= form "") (setq form yahtml-last-form))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
905 (setq yahtml-last-form form)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
906 (if yahtml-prefer-upcases (setq form (upcase form)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
907 (insert (format "<%s%s>" form (yahtml-addin form)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
908 ;;(indent-relative-maybe)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
909 (if (cdr (assoc form yahtml-form-table))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
910 (save-excursion (insert (format "</%s>" form))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
911 (if (search-backward "\"\"" p t) (forward-char 1))))
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
912
396
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
913 (defun yahtml-read-css (alist &optional element)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
914 (let ((completion-ignore-case t) (delim " ")
396
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
915 (minibuffer-completion-table alist)
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
916 (quotekey (substitute-command-keys "\\[quoted-insert]")))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
917 (read-from-minibuffer-with-history
396
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
918 (if YaTeX-japan
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
919 (format "%sクラス(複数指定は%s SPCで区切る): "
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
920 (if element (concat element "の") "") quotekey)
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
921 (format "class%s(multiple class can be delimited by %s SPC): "
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
922 (if element (concat " for " element) "") quotekey))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
923 nil YaTeX-minibuffer-completion-map nil)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
924
138
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
925 (defvar yahtml-newpage-command "newpage.rb"
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
926 "*Command name to create new HTML file referring to index.html.
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
927 This command should create new HTML file named argument 1 and
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
928 output string like `<a href=\"newfile.html\">anchor tag</a>'.
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
929 This program should take -o option to overwrite existing HTML file.")
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
930 (defun yahtml-newpage (file ov)
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
931 "Create newpage via newpage script"
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
932 (interactive
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
933 (list
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
934 (let (insert-default-directory)
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
935 (read-file-name "New webpage file name: " ""))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
936 current-prefix-arg))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
937 (if (and (file-exists-p file) (not ov))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
938 (error "%s already exists. Call this with universal argument to force overwrite." file))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
939 (insert (substring
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
940 (YaTeX-command-to-string
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
941 (concat yahtml-newpage-command " " (if ov "-o ") file))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
942 0 -1)))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
943
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
944 ;;; ---------- Add-in ----------
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
945 (defun yahtml-addin (form)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
946 "Check add-in function's existence and call it if exists."
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
947 (let ((addin (concat "yahtml:" (downcase form))) s a)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
948 (concat
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
949 (and (setq a (yahtml-css-get-element-completion-alist form))
290
1a4332ecc58b For emacs-24.3+ and NEmacs(last-command-{char,event} handling)
HIROSE Yuuji <yuuji@gentei.org>
parents: 286
diff changeset
950 (not (equal (YaTeX-last-key) ?\C-j))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
951 (memq yahtml-current-completion-type '(multiline inline))
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
952 (not (string-match "#\\|source" form))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
953 (yahtml-make-optional-argument ;should be made generic?
396
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
954 "class" (yahtml-read-css a form)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
955 (if (and (intern-soft addin) (fboundp (intern-soft addin))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
956 (stringp (setq s (funcall (intern addin))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
957 (string< "" s))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
958 (if (eq (aref s 0) ? ) s (concat " " s))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
959 ""))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
960
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
961 (defvar yahtml-completing-buffer nil)
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
962 (defun yahtml-collect-labels (&optional file ptn withouthash)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
963 "Collect current buffers label (<?? name=...>).
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
964 If optional argument FILE is specified collect labels in FILE."
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
965 (let ((attrptn (concat "\\(" (or ptn "name\\|id") "\\)\\s *="))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
966 (hash (if withouthash "" "#"))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
967 list end)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
968 (save-excursion
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
969 (set-buffer (or yahtml-completing-buffer (current-buffer)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
970 (if file (let (hilit-auto-highlight)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
971 (set-buffer (find-file-noselect file))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
972 (save-excursion
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
973 (goto-char (point-min))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
974 (while ;(re-search-forward "<\\w+\\b" nil t)
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
975 (re-search-forward attrptn nil t)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
976 ;(setq bound (match-end 0))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
977 ;(search-forward ">" nil t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
978 (setq end (match-end 0))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
979 (if (and ;(re-search-backward "\\(name\\|id\\)\\s *=" bound t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
980 (yahtml-on-assignment-p)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
981 (progn
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
982 (goto-char end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
983 (skip-chars-forward " \t\n")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
984 (looking-at "\"?#?\\([^\">]+\\)\"?\\b")))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
985 (setq list (cons
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
986 (list (concat hash (YaTeX-match-string 1)))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
987 list))))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
988 list))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
989
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
990 (defun yahtml-collect-ids (&optional file)
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
991 (yahtml-collect-labels file "id" 'withouthash))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
992
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
993 (defvar yahtml-url-completion-map nil "Key map used in URL completion buffer")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
994 (if yahtml-url-completion-map nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
995 (setq yahtml-url-completion-map
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
996 (copy-keymap minibuffer-local-completion-map))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
997 (define-key yahtml-url-completion-map "\t" 'yahtml-complete-url)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
998 (define-key yahtml-url-completion-map " " 'yahtml-complete-url))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
999
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1000 (defun yahtml-complete-url ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1001 "Complete external URL from history or local file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1002 (interactive)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1003 (let ((p (point)) initial i2 cmpl path dir file listfunc beg labels
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1004 (lim (YaTeX-minibuffer-begin))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1005 (min (if (fboundp 'field-beginning) (field-beginning) (point-min))))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1006 (setq initial (YaTeX-minibuffer-string))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1007 (cond
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1008 ((string-match "^htt" initial)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1009 (setq cmpl (try-completion initial yahtml-urls)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1010 listfunc (list 'lambda nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1011 (list 'all-completions initial 'yahtml-urls))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1012 beg min))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1013 ((setq beg (string-match "#" initial))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1014 (or (equal beg 0) ;begin with #
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1015 (progn
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1016 (setq path (substring initial 0 beg))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1017 (if (string-match "^/" path)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1018 (setq path (yahtml-url-to-path path)))))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1019 (setq initial (substring initial beg))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1020 (setq labels (yahtml-collect-labels path)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1021 cmpl (try-completion initial labels)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1022 listfunc (list 'lambda ()
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1023 (list 'all-completions
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1024 initial (list 'quote labels)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1025 beg (+ min beg)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1026 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1027 (setq path (if (string-match "^/" initial)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1028 (or (yahtml-url-to-path initial) initial)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1029 initial))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1030 (setq dir (or (file-name-directory path) ".")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1031 file (file-name-nondirectory path)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1032 initial file
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1033 cmpl (file-name-completion file dir)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1034 listfunc (list 'lambda nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1035 (list 'file-name-all-completions
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1036 file dir))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1037 beg (save-excursion (skip-chars-backward "^/" lim) (point)))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1038 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1039 ((stringp cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1040 (if (string= initial cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1041 (with-output-to-temp-buffer "*Completions*"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1042 (princ "Possible completinos are:\n")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1043 (princ
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
1044 (mapconcat (function(lambda (x) x)) (funcall listfunc) "\n")))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1045 (delete-region (point) beg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1046 (insert cmpl)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1047 ((null cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1048 (ding))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1049 ((eq t cmpl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1050 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1051 (unwind-protect
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1052 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1053 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1054 (insert " [Sole completion]"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1055 (delete-region p (point-max))))))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1056
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1057 ;
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1058 ; Subject: [yatex:02849] Re: [yahtml] tilda in href tag
193
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 191
diff changeset
1059 ; From: Masayasu Ishikawa <mimasa<at>sfc.keio.ac.jp>
e216f9f347fa Camouflage email addresses.
yuuji@gentei.org
parents: 191
diff changeset
1060 ; To: yatex<at>arcadia.jaist.ac.jp
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1061 ; Date: Mon, 31 May 1999 21:09:31 +0900
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1062 ; RFC 2396 の "2.4.3. Excluded US-ASCII Characters" によると、以下の文字
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1063 ; は必ずエスケープしないといけません。
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1064 ;
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1065 ; control = <US-ASCII coded characters 00-1F and 7F hexadecimal>
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1066 ; space = <US-ASCII coded character 20 hexadecimal>
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1067 ; delims = "<" | ">" | "#" | "%" | <">
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1068 ; unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1069 (defvar yahtml-unsafe-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1070 "[][\x0- \x7f <>%\"{}|\\^`]" ;#は除去する
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1071 "Characters regexp which must be escaped in URI.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1072 ;
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1073 ; また、以下の文字は予約された用法以外に用いる場合にはエスケープしないと
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1074 ; いけないことになっています。
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1075 ;
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1076 ; reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1077 ; "$" | ","
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1078 (defvar yahtml-unreserved-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1079 "[;/?:@&=+$,]"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1080 "Characters regexp which should be escaped in URI on certain conditions.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1081 Not used yet.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1082
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1083 (defun yahtml-escape-chars-string (str)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1084 "Translate reserved chars to URL encoded string."
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1085 (let ((p 0) (target "")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1086 (ask (eq yahtml-escape-chars 'ask)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1087 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1088 ((null yahtml-escape-chars) str)
573
9e07513fc2ef Do not escape URL when it has triple `%XX's
HIROSE Yuuji <yuuji@gentei.org>
parents: 569
diff changeset
1089 ((string-match "%[0-9A-F][0-9A-F]%[0-9A-F][0-9A-F]%[0-9A-F][0-9A-F]" str)
9e07513fc2ef Do not escape URL when it has triple `%XX's
HIROSE Yuuji <yuuji@gentei.org>
parents: 569
diff changeset
1090 str)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1091 (t
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1092 (while (and (string< "" str)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1093 (setq p (string-match yahtml-unsafe-chars-regexp str)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1094 (if (and ask (y-or-n-p (format "Escape char [%c] of `%s'"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1095 (aref str p) (substring str 0 (1+ p)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1096 (setq target (concat target
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1097 (substring str 0 p)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1098 (format "%%%x" (aref str p))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1099 (setq target (concat target (substring str 0 (1+ p)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1100 (setq str (substring str (1+ p))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1101 (concat target str)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1102
153
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1103 (defun yahtml-unescape-string (str)
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1104 "Untranslate reserved URL-encoded string."
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1105 (let ((p 0) c (target "") (md (match-data)) (case-fold-search nil))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1106 (unwind-protect
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1107 (progn
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1108 (while (string-match "%\\([0-9a-f][0-9a-f]\\)" str p)
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1109 (setq target (concat target
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1110 (substring str p (1- (match-beginning 1))))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1111 p (match-end 0)
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1112 c (YaTeX-hex (substring
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1113 str (match-beginning 1) (match-end 1)))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1114 target (concat target (format "%c" c))))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1115 (concat target (substring str p)))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1116 (store-match-data md))))
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1117
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1118 (defun yahtml-escape-chars-region (beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1119 "Translate reserved chars to encoded string in the region."
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1120 (interactive "r")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1121 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1122 (let ((e (set-marker (make-marker) end)) c m yes)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1123 (goto-char beg)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1124 (while (and (< (point) e)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1125 (re-search-forward
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1126 (concat yahtml-unsafe-chars-regexp "\\|"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1127 yahtml-unreserved-chars-regexp) e t))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1128 (sit-for 0)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1129 ; (setq m (buffer-modified-p)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1130 ; c (char-after (1- (point))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1131 ; (save-excursion (backward-char 1) (insert " ==>"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1132 ; (unwind-protect
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1133 ; (setq yes (y-or-n-p (format "Replace: [%c]" c)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1134 ; (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1135 ; (backward-char 1)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1136 ; (delete-backward-char 4))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1137 ; (set-buffer-modified-p m))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1138 (message "Replace: [%c] (y or n):" (setq c (char-after (1- (point)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1139 (if (memq (read-char) '(?y ?Y))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1140 (progn
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1141 (delete-region (match-beginning 0) (match-end 0))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1142 (insert (format "%%%x" c)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1143 (set-marker e nil))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1144 ;; ab%defgls/.|
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1145
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1146 (defun yahtml-read-url (prompt)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1147 (let ((href ""))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1148 (setq yahtml-completing-buffer (current-buffer)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1149 yahtml-urls (append yahtml-urls-private yahtml-urls-local)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1150 href (yahtml-escape-chars-string
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1151 (read-from-minibuffer-with-history
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1152 prompt "" yahtml-url-completion-map)))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1153 (prog1
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1154 href
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1155 (if (and (string-match "^https?://" href)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1156 (null (assoc href yahtml-urls-private))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1157 (null (assoc href yahtml-urls-local)))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1158 (YaTeX-update-table
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1159 (list href)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
1160 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1161
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1162 (defun yahtml:a ()
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1163 "Add-in function for <a>"
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1164 (let ((href (yahtml-read-url "href: ")))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1165 (concat (yahtml-make-optional-argument
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1166 "href" href)
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1167 (yahtml-make-optional-argument
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1168 "name" (read-string-with-history "name: ")))))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1169
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1170 (defvar yahtml-parameters-completion-alist
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1171 '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center"))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1172 ("clear" ("left") ("right") ("center") ("all") ("none"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1173 ("lang" ("ja") ("en") ("kr") ("ch") ("fr"))
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1174 ("src" . file) ("file" . file) ("poster" . file)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1175 ("background" . file)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1176 ("class file name" . file) ("data" . file)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1177 ("method" ("POST") ("GET"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1178 ("rev" . yahtml-link-types-alist)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1179 ("rel" . yahtml-link-types-alist)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1180 ("type" . yahtml-content-types-alist)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1181 ("codetype" . yahtml-content-types-alist)
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1182 ("http-equiv" ("Refresh") ("Content-Language") ("Content-Type"))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1183 ("charset"
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1184 ("utf-8")("euc-jp")("iso-2022-jp")("iso-8859-1")("shift_jis"))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1185
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1186 (defvar yahtml-link-types-alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1187 '(("alternate") ("stylesheet") ("start") ("next") ("prev")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1188 ("contents") ("index") ("glossary") ("chapter") ("section")
597
722004cc4375 Add "manifest" to link attribute completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 583
diff changeset
1189 ("subsection") ("appendix") ("help") ("bookmark") ("manifest")))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1190
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1191 (defvar yahtml-content-types-alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1192 '(("text/css") ("text/html") ("text/plain") ("text/richtext")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1193 ("text/sgml") ("text/xml")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1194 ("text/javascript") ("text/tcl") ("text/vbscript")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1195 ("application/octet-stream") ("application/postscript") ("application/pdf")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1196 ("application/java")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1197 ("image/jpeg") ("image/gif") ("image/tiff") ("image/png") ("video/mpeg"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1198 "Alist of content-types")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1199
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1200 (defun yahtml-read-parameter (par &optional default alist predicate)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1201 (let* ((alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1202 (cdr-safe (assoc (downcase par)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1203 (or alist yahtml-parameters-completion-alist))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1204 (prompt (concat par ": "))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1205 v)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1206 (cond
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1207 ((eq alist 'file)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1208 (let ((insert-default-directory))
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1209 (read-file-name prompt "" default nil "" predicate)))
147
f9d3c2451d19 get-builtin for yahtml
yuuji@gentei.org
parents: 145
diff changeset
1210 ((eq alist 'command)
f9d3c2451d19 get-builtin for yahtml
yuuji@gentei.org
parents: 145
diff changeset
1211 (if (fboundp 'read-shell-command)
f9d3c2451d19 get-builtin for yahtml
yuuji@gentei.org
parents: 145
diff changeset
1212 (read-shell-command prompt)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1213 (read-string-with-history prompt)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1214 ((and alist (symbolp alist))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1215 (completing-read-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1216 prompt (symbol-value alist) nil nil default))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1217 (alist
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1218 (completing-read-with-history prompt alist nil nil default))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1219 (t
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1220 (read-string-with-history prompt default)))))
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1221
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1222 (defun yahtml-read-file-name-regexp
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1223 (prompt regexp &optional dir default-filename mustmatch initial)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1224 (let ((pred
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1225 (function
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1226 (lambda (f)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1227 (or (file-name-directory f)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1228 (string-match regexp f)))))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1229 (insert-default-directory nil))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1230 (read-file-name prompt dir default-filename mustmatch initial pred)))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1231
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1232
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1233 (defun yahtml-make-optional-argument (opt arg)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1234 "Make optional argument string."
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1235 (if (or (null arg) (string= "" arg))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1236 ""
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1237 (concat " "
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1238 (if yahtml-prefer-upcase-attributes (upcase opt) (downcase opt))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1239 "=\"" arg "\"")))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1240
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1241 (defun yahtml:html ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1242 "Add-in for <html>"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1243 (setq yahtml-last-begend "head" yahtml-last-typeface-cmd "head")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1244 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1245 "lang" (yahtml-read-parameter "lang" (if YaTeX-japan "ja"))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1246
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1247 (defun yahtml:head ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1248 "Add-in for <head>"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1249 (setq yahtml-last-begend "title" yahtml-last-typeface-cmd "title")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1250 "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1251
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1252 (defun yahtml:body ()
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1253 "Add-in function for <body>"
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1254 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1255 (yahtml-html4-strict nil)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1256 (t
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1257 (let ((b (read-string-with-history "bgcolor="))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1258 (bg (yahtml-read-parameter "background" ""))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1259 (x (read-string-with-history "text color="))
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1260 (l (read-string-with-history "link color="))
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1261 (v (read-string-with-history "vlink color=")))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1262 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1263 (yahtml-make-optional-argument "bgcolor" b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1264 (yahtml-make-optional-argument "background" bg)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1265 (yahtml-make-optional-argument "text" x)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1266 (yahtml-make-optional-argument "link" l)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1267 (yahtml-make-optional-argument "vlink" v))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1268
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1269 (defun yahtml-make-style-parameter (proplist)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1270 "Make CSS property definitions in style attribute."
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1271 (mapconcat
353
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
1272 (function (lambda (x) (if (and (cdr x) (string< "" (cdr x)))
2a72779d9c50 Rewrite lambda notations to suppress annoying warnings from emacs24
HIROSE Yuuji <yuuji@gentei.org>
parents: 330
diff changeset
1273 (format "%s: %s;" (car x) (cdr x)))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1274 (delq nil proplist)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1275 " "))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1276
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1277 (defun yahtml:img ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1278 "Add-in function for <img>"
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1279 (let ((src (yahtml-read-parameter "src"))
467
4f8551386af2 Do not ask `align' when html4-strict mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 466
diff changeset
1280 (alg (if yahtml-html4-strict nil (yahtml-read-parameter "align")))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1281 alt
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1282 (brd (read-string-with-history "border="))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1283 (l yahtml-prefer-upcase-attributes)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1284 info width height bytes comments)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1285 (and (stringp src) (string< "" src) (file-exists-p src)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1286 (setq info (yahtml-get-image-info src))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1287 (car info)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1288 (setq width (int-to-string (car info))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1289 height (int-to-string (car (cdr info)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1290 bytes (car (cdr (cdr info)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1291 comments (nth 4 info)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1292 (if info
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1293 (setq alt
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1294 (YaTeX-replace-formats
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1295 yahtml:img-default-alt-format
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1296 (list (cons "x" width)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1297 (cons "y" height)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1298 (cons "s" (int-to-string bytes))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1299 (cons "f" (file-name-nondirectory src))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1300 (cons "c" (car comments))))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1301
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1302 (setq alt (yahtml-read-parameter "alt" alt))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1303 (setq width (yahtml-read-parameter "width" width)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1304 height (yahtml-read-parameter "height" height))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1305 (concat (if l "SRC" "src") "=\"" src "\""
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1306 (yahtml-make-optional-argument "alt" alt)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1307 (yahtml-make-optional-argument "width" width)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1308 (yahtml-make-optional-argument "height" height)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1309 (if yahtml-html4-strict
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1310 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1311 "style"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1312 (if (or brd alg)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1313 (yahtml-make-style-parameter
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1314 (list
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1315 (if (string< "" alg)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1316 (cons "align" alg))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1317 (if (string< "" brd)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1318 (cons "border"
451
2011de73a671 Who owes the incompatibility of string-to-int?
HIROSE Yuuji <yuuji@gentei.org>
parents: 443
diff changeset
1319 (format "%dpx" (YaTeX-str2int brd))))))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1320 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1321 (yahtml-make-optional-argument "border" brd)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1322 (yahtml-make-optional-argument "align" alg))))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1323
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1324 (defun yahtml-file-truename (file)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1325 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1326 ((fboundp 'file-truename) (file-truename (expand-file-name file)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1327 (t (let ((new file))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1328 (while (and (stringp (setq new (nth 0 (file-attributes file))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1329 (not (equal new file)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1330 (setq file new))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1331 file))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1332
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1333 (defun yahtml-hex-value (point length &optional little-endian)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1334 "Return the hex value the POINT positions LENGTH byte stream represents.
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1335 Optional third argument LITTLE-ENDIAN is self extplanatory."
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1336 (setq point (1+ point)) ;translate file offset to Emacs's point value
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1337 (let ((mlt 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1338 (pos (if little-endian point (+ point length -1)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1339 (direc (if little-endian 1 -1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1340 (value 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1341 (while (> length 0)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1342 (setq value (+ value (* mlt (char-after pos)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1343 pos (+ pos direc)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1344 mlt (* mlt 256)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1345 length (1- length)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1346 value))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1347
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1348 (defun yahtml-get-image-info (file)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1349 "Return the information on the image file FILE.
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1350 Returns list of '(WIDTH HEIGHT BYTES DEPTH COMMENTLIST)."
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1351 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1352 (let*((tmpbuf (get-buffer-create " *imgheader*"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1353 width height bytes depth comment
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1354 (file-coding-system-alist (list (cons "." 'no-conversion))) ;20
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1355 (file-coding-system-for-read (and (boundp '*noconv*) *noconv*)) ;19
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1356 (coding-system-for-read 'no-conversion)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1357 (seekpoint 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1358 c1 c2 c3 c4 beg end
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1359 (case-fold-search nil))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1360 (setq bytes (nth 7 (file-attributes (yahtml-file-truename file))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1361 (set-buffer tmpbuf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1362 (if (boundp 'mc-flag) (set (make-local-variable 'mc-flag) nil))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1363 (erase-buffer)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1364 (if (fboundp 'set-buffer-multibyte) (set-buffer-multibyte nil))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1365 (unwind-protect
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1366 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1367 (message "Inspecting image information of %s..." file)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1368 ;; Read 4bytes-more than inspection-bytes in case that
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1369 ;; JPEG marker delimiter (4bytes) is on the alignment.
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1370 (YaTeX-insert-file-contents
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1371 file nil 0 (+ yahtml-image-inspection-bytes 4))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1372 (goto-char (point-min)) ;assertion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1373 (setq c1 (char-after 1) ;cache first 4 bytes
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1374 c2 (char-after 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1375 c3 (char-after 3)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1376 c4 (char-after 4))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1377 (cond
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1378 ((and (eq c1 ?\377) (eq c2 ?\330)) ; 0xff 0xd8
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1379 ;;JPEG images need JPEG markers inspection
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1380 ;;JPEG markers consist of [ 0xff ID(B) LEN(S) CONTENTS... ]
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1381 ;; Warning: here seekpoint is measured by Emacs's point value
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1382 ;; while yahtml-hex-vale requires file offset
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1383 (setq seekpoint 3) ;where the first JPEG marker exists
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1384 (catch 'exit
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1385 (while (< seekpoint (- (buffer-size) 4))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1386 (cond
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1387 ((not (eq (char-after seekpoint) ?\377))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1388 ;maybe corrupted, exit from loop
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1389 (throw 'exit t))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1390 ((memq
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1391 (char-after (1+ seekpoint))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1392 '(?\300 ?\301 ?\302 ?\303
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1393 ?\305 ?\306 ?\307 ?\311 ?\312 ?\313 ?\315 ?\316 ?\317))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1394 ;;'(192 193 194 195 197 198 199 201 202 203 205 206 207
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1395 ;;found!
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1396 (setq height (yahtml-hex-value (+ seekpoint 4) 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1397 width (yahtml-hex-value (+ seekpoint 6) 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1398 depth (yahtml-hex-value (+ seekpoint 3) 1)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1399 ((eq (char-after (1+ seekpoint)) ?\376) ;0xFE = comment
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1400 ;; JPEG comment area
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1401 (setq beg (+ seekpoint 2 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1402 end (+ seekpoint
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1403 (yahtml-hex-value (1+ seekpoint) 2) 2))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1404 (setq comment (cons (buffer-substring beg end) comment)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1405 (t ;other markers
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1406 nil)) ;just skip it
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1407 (setq seekpoint (+ seekpoint 2)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1408 seekpoint (+ seekpoint
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1409 (yahtml-hex-value (1- seekpoint) 2))))))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1410 ((and (eq c1 ?\211) ;0x89
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1411 (eq c2 ?P) (eq c3 ?N) (eq c4 ?G))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1412 ;;PNG Image data X=@0x10(L), Y=@0x14(L), D=@0x18(B)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1413 (setq width (yahtml-hex-value 16 4)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1414 height (yahtml-hex-value 20 4)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1415 depth (yahtml-hex-value 24 1)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1416 ((looking-at "GIF8")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1417 ;;GIF Image data X=@0x6(leshort), Y=@0x8(leshort)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1418 (setq width (yahtml-hex-value 6 2 t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1419 height (yahtml-hex-value 8 2 t)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1420 ((looking-at "BM")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1421 ;;# OS/2, Windoze BMP files
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1422 ;;@0x0e = 12 -> OS/2 1.x - X=@0x12(leshort), Y=@0x14(leshort)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1423 ;;@0x0e = 64 -> OS/2 2.x - X=@0x12(leshort), Y=@0x14(leshort)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1424 ;;@0x0e = 40 -> Windows 3.x - X=@0x12(lelong), Y=@0x16(lelong)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1425 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1426 ((eq (yahtml-hex-value 14 2 t) 40)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1427 (setq width (yahtml-hex-value 18 4 t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1428 height (yahtml-hex-value 22 4 t)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1429 (t
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1430 (setq width (yahtml-hex-value 18 2 t)
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
1431 height (yahtml-hex-value 20 2 t)))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1432 (message "")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1433 (kill-buffer tmpbuf))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1434 (list width height bytes depth (nreverse comment)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1435
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1436 (defun yahtml:form ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1437 "Add-in function `form' input format"
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1438 (concat
162
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1439 " " (if yahtml-prefer-upcase-attributes "METHOD" "method") "=\""
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1440 (completing-read-with-history "Method: " '(("POST") ("GET")) nil t)
162
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1441 "\""
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1442 (yahtml-make-optional-argument
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1443 (if yahtml-prefer-upcase-attributes "ENCTYPE" "enctype")
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1444 (completing-read-with-history
162
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1445 "Enctype: "
af550c574ae1 Add `enctype' attribute completion to 'yahtml:form.
yuuji@gentei.org
parents: 161
diff changeset
1446 '(("application/x-www-form-urlencoded") ("multipart/form-data"))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1447 " " (if yahtml-prefer-upcase-attributes "ACTION" "action") "=\""
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1448 (read-string-with-history "Action: ") "\""))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1449
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1450 (defun yahtml:select ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1451 "Add-in function for `select' input format"
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1452 (setq yahtml-last-single-cmd "option" ;;<- it's old
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1453 yahtml-last-typeface-cmd "option")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1454 (concat " " (if yahtml-prefer-upcase-attributes "NAME" "name") "=\""
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1455 (read-string-with-history "name: ") "\""))
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1456 (defun yahtml:label ()
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1457 "Add-in function for `<label>'"
439
2521a95043af yahtml:label fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 438
diff changeset
1458 (yahtml-make-optional-argument
2521a95043af yahtml:label fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 438
diff changeset
1459 "for"
2521a95043af yahtml:label fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 438
diff changeset
1460 (YaTeX-completing-read-or-skip "for=" (yahtml-collect-ids) nil t)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1461
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1462 (defun yahtml:ol ()
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1463 "Add-in function for <ol>"
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
1464 (setq yahtml-last-typeface-cmd "li")
243
74229d191b17 C-j skip can be used at <ol> and <input>.
yuuji@gentei.org
parents: 205
diff changeset
1465 (let ((start (YaTeX-read-string-or-skip "start="))
74229d191b17 C-j skip can be used at <ol> and <input>.
yuuji@gentei.org
parents: 205
diff changeset
1466 (type (YaTeX-completing-read-or-skip
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1467 "type=" '(("1") ("a") ("A") ("i") ("I")) nil t)))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1468 (concat
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1469 (yahtml-make-optional-argument "start" start)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1470 (yahtml-make-optional-argument "type" type))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1471 (defun yahtml:ul ()
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
1472 (setq yahtml-last-typeface-cmd "li") "")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1473 (defun yahtml:dl ()
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
1474 (setq yahtml-last-typeface-cmd "dt") "")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1475 (defun yahtml:dt ()
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
1476 (setq yahtml-last-typeface-cmd "dd") "")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1477
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1478 (defun yahtml:p ()
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1479 (if yahtml-html4-strict nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1480 (let ((alg (yahtml-read-parameter "align")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1481 (yahtml-make-optional-argument "align" alg))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1482
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1483 (defvar yahtml-input-types
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1484 '(("text") ("password") ("checkbox") ("radio") ("submit")
598
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1485 ("reset") ("image") ("hidden") ("file")
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1486 ("date") ("time") ("datetime-local") ("week") ("number") ("tel")
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1487 ("range") ("color")))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1488
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1489 (defun yahtml:input ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1490 "Add-in function for `input' form"
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1491 (let ((size "") name type value id (maxlength "")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1492 (l yahtml-prefer-upcase-attributes))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1493 (setq name (read-string-with-history "name: ")
243
74229d191b17 C-j skip can be used at <ol> and <input>.
yuuji@gentei.org
parents: 205
diff changeset
1494 type (YaTeX-completing-read-or-skip "type (default=text): "
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1495 yahtml-input-types nil t)
465
e9299b77df1f Argument error fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 462
diff changeset
1496 value (YaTeX-read-string-or-skip "value: "))
e9299b77df1f Argument error fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 462
diff changeset
1497 (or (string-match "submit\\|reset" type)
e9299b77df1f Argument error fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 462
diff changeset
1498 (setq id (YaTeX-read-string-or-skip "id: ")))
e9299b77df1f Argument error fixed
HIROSE Yuuji <yuuji@gentei.org>
parents: 462
diff changeset
1499 (if (string-match "text\\|password\\|^$" type)
243
74229d191b17 C-j skip can be used at <ol> and <input>.
yuuji@gentei.org
parents: 205
diff changeset
1500 (setq size (YaTeX-read-string-or-skip "size: ")
74229d191b17 C-j skip can be used at <ol> and <input>.
yuuji@gentei.org
parents: 205
diff changeset
1501 maxlength (YaTeX-read-string-or-skip "maxlength: ")))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1502 (concat
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1503 (if l "NAME" "name") "=\"" name "\""
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1504 (yahtml-make-optional-argument "type" type)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1505 (yahtml-make-optional-argument "value" value)
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1506 (yahtml-make-optional-argument "id" id)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1507 (yahtml-make-optional-argument "size" size)
598
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1508 (if (string-match "range" type)
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1509 (concat (yahtml-make-optional-argument
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1510 "min" (YaTeX-read-string-or-skip "min: "))
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1511 (yahtml-make-optional-argument
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1512 "max" (YaTeX-read-string-or-skip "max: "))
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1513 (yahtml-make-optional-argument
ebe2b7a66b9d Add input type="range" completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 597
diff changeset
1514 "step" (YaTeX-read-string-or-skip "step: "))))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
1515 (yahtml-make-optional-argument "maxlength" maxlength))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1516
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1517 (defun yahtml:datalist ()
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1518 "Add-in function for `datalist' form"
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1519 (setq yahtml-last-typeface-cmd "option")
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1520 (let ((ids (yahtml-collect-ids)))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1521 (yahtml-make-optional-argument
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1522 "id" (YaTeX-completing-read-or-skip "id: " ids nil t))))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
1523
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1524 (defun yahtml:textarea ()
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1525 "Add-in function for `textarea'"
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1526 (interactive)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1527 (let (name rows cols)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1528 (setq name (read-string-with-history "Name: ")
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1529 cols (read-string-with-history "Columns: ")
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1530 rows (read-string-with-history "Rows: "))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1531 (concat
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1532 (concat (if yahtml-prefer-upcase-attributes "NAME=" "name=")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1533 "\"" name "\"")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1534 (yahtml-make-optional-argument "cols" cols)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1535 (yahtml-make-optional-argument "rows" rows))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1536
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1537 (defun yahtml:table ()
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1538 "Add-in function for `table'"
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1539 (let ((b (read-string-with-history "border="))
428
9219b8c610f8 "label"
HIROSE Yuuji <yuuji@gentei.org>
parents: 411
diff changeset
1540 (a (if yahtml-html4-strict ""
9219b8c610f8 "label"
HIROSE Yuuji <yuuji@gentei.org>
parents: 411
diff changeset
1541 (yahtml-read-parameter
9219b8c610f8 "label"
HIROSE Yuuji <yuuji@gentei.org>
parents: 411
diff changeset
1542 "align" nil '(("align" ("right")("center")))))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1543 (if yahtml-html4-strict
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1544 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1545 "style"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1546 (if (or (string< "" b) (string< "" a))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1547 (yahtml-make-style-parameter
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1548 (append
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1549 (if (string< "" b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1550 (list
451
2011de73a671 Who owes the incompatibility of string-to-int?
HIROSE Yuuji <yuuji@gentei.org>
parents: 443
diff changeset
1551 (cons "border" (format "%dpx solid" (YaTeX-str2int b)))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1552 (cons "border-collapse" "collapse")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1553 (if (string< "" a)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1554 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1555 ((string-match "right" a)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1556 (list (cons "margin-left" "auto")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1557 (cons "margin-right" "0")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1558 ((string-match "center" a)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1559 (list (cons "margin-left" "auto")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1560 (cons "margin-right" "auto")))))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1561 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1562 (yahtml-make-optional-argument "border" b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1563 (yahtml-make-optional-argument "align" a)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1564
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1565 ;(fset 'yahtml:caption 'yahtml:p)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1566 (defun yahtml:caption ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1567 "Add-in function for `caption' in table tag"
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1568 (let ((par (yahtml-read-parameter "align")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1569 (if yahtml-html4-strict
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1570 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1571 "style" (if par (yahtml-make-style-parameter
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1572 (list (cons "caption-side" par)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1573 (yahtml-make-optional-argument "align" par))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1574
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1575 (defun yahtml:font ()
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1576 "Add-in function for `font'"
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1577 (concat
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1578 (yahtml-make-optional-argument "color" (read-string-with-history "color="))
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1579 (yahtml-make-optional-argument "size" (read-string-with-history "size="))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1580
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1581 (defun yahtml:style ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1582 "Add-in function for `style'"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1583 (yahtml-make-optional-argument
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1584 "type" (read-string-with-history "type=" "text/css")))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1585
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1586 (defun yahtml:script ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1587 "Add-in function for `script'"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1588 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1589 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1590 "type" (yahtml-read-parameter "type" "text/javascript"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1591 (yahtml-make-optional-argument
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1592 "src" (yahtml-read-parameter "src" ""))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1593
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1594 (defun yahtml:tr ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1595 "Add-in function for `tr'"
458
1a891f775194 'figure' and 'figcaption'
HIROSE Yuuji <yuuji@gentei.org>
parents: 451
diff changeset
1596 (setq yahtml-last-typeface-cmd "td")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1597 "")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1598
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1599 (defun yahtml:link ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1600 "Add-in function for `link' (まだちょっと良く分かってない)"
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1601 (let (rel rev type href)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1602 (setq rel (yahtml-read-parameter "rel"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1603 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1604 ((equal rel "")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1605 (concat (yahtml-make-optional-argument
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1606 "rev" (yahtml-read-parameter "rev"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1607 (yahtml-make-optional-argument
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1608 "href" (yahtml-read-parameter "href")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1609 ;;他に良く使うのって何?
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1610 )))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1611 ((string-match "stylesheet" rel)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1612 (concat
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1613 (yahtml-make-optional-argument "rel" rel)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1614 (yahtml-make-optional-argument
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1615 "type" (yahtml-read-parameter "type" "text/css"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1616 (progn
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1617 (setq href
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1618 (read-from-minibuffer-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1619 "href: " "" yahtml-url-completion-map))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1620 (if (string< "" href)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1621 (progn
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1622 (if (and (file-exists-p (yahtml-url-to-path href))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1623 (y-or-n-p "Load css symbols now? "))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1624 (setq yahtml-css-class-alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1625 (yahtml-css-collect-classes-file
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1626 (yahtml-url-to-path href) yahtml-css-class-alist)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1627 (message "")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1628 (yahtml-make-optional-argument "href" href))))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1629 (t
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1630 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1631 (yahtml-make-optional-argument "rel" rel)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1632 (yahtml-make-optional-argument
597
722004cc4375 Add "manifest" to link attribute completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 583
diff changeset
1633 "type" (yahtml-read-parameter "type"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1634 (yahtml-make-optional-argument
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
1635 "href"
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1636 (read-from-minibuffer-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1637 "href: " "" yahtml-url-completion-map)))))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1638
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1639 (defvar yahtml:meta-attrs
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1640 '(("charset" value)
550
d97881f33e28 Add default template string for name="vieport" to meta completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 485
diff changeset
1641 ("name" content ("keywords")("author")("copyright")("date")("GENERATOR")
d97881f33e28 Add default template string for name="vieport" to meta completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 485
diff changeset
1642 ("viewport"))
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1643 ("http-equiv" content)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1644
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1645 (defun yahtml:meta ()
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1646 (let ((attr (completing-read-with-history
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1647 "Meta Attribute: " yahtml:meta-attrs))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1648 (case-fold-search t)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1649 (completion-ignore-case t)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1650 todonext name http-equiv content)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1651 (cond
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1652 ((string= "" attr) nil)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1653 ((and (setq todonext (cdr-safe (assoc attr yahtml:meta-attrs)))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1654 (eq 'value (car todonext)))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1655 (yahtml-make-optional-argument attr (yahtml-read-parameter attr)))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1656 ((eq 'content (car todonext))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1657 (setq name (if (cdr todonext)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1658 (completing-read-with-history
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1659 (format "%s: " attr) (cdr todonext))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1660 (yahtml-read-parameter attr)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1661 (concat
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1662 (yahtml-make-optional-argument attr name)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1663 (yahtml-make-optional-argument
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1664 "content"
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1665 (cond
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1666 ((string-match "date" name)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1667 (read-string-with-history "Date: " (current-time-string)))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1668 ((string-match "author" name)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1669 (read-string-with-history "Author: "
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1670 (if (and (user-full-name) (string< "" (user-full-name)))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1671 (user-full-name)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1672 (user-login-name))))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1673 ((string-match "GENERATOR" name)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1674 (setq content (read-string-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
1675 "Generator: " "User-agent: "))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1676 (if (string-match "yahtml" content)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1677 (message "Thank you!"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1678 content)
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1679 ((string-match "content-type" name)
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1680 (if (string-match "http-equiv" attr )
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1681 (error "Use <meta charset=\"...\" instead.. See docs/qanda.")
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1682 (yahtml-make-optional-argument
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1683 "content" (yahtml-read-parameter "content"))))
550
d97881f33e28 Add default template string for name="vieport" to meta completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 485
diff changeset
1684 ((string-match "viewport" name)
d97881f33e28 Add default template string for name="vieport" to meta completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 485
diff changeset
1685 ;; XXX: Very dirty static string
d97881f33e28 Add default template string for name="vieport" to meta completion
HIROSE Yuuji <yuuji@gentei.org>
parents: 485
diff changeset
1686 "width=device-width, initial-scale=1")
475
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1687 (t (read-string-with-history (concat name ": ")))))))
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1688 (t (yahtml-make-optional-argument
d6952c7e35cc Add-in completion for "meta" element now supports charset attribute.
HIROSE Yuuji <yuuji@gentei.org>
parents: 467
diff changeset
1689 attr (yahtml-read-parameter attr))))))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1690
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1691 (defun yahtml:br ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1692 (yahtml-make-optional-argument "clear" (yahtml-read-parameter "clear")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1693
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1694 (defun yahtml:object ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1695 (let ((codetype (yahtml-read-parameter "codetype" "application/java"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1696 data classid)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1697 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1698 ((string-match "java" codetype)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1699 (let ((completion-ignored-extensions
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1700 ;;any extensions except ".class"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1701 '(".java" ".html" ".htm" ".gif" ".jpg" ".jpeg" ".png")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1702 (setq classid (concat "java:"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1703 (yahtml-read-parameter "class file name"))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1704 (concat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1705 (yahtml-make-optional-argument "codetype" codetype)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1706 (yahtml-make-optional-argument "classid" classid)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1707 (yahtml-make-optional-argument
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1708 "width" (yahtml-read-parameter "width"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1709 (yahtml-make-optional-argument
467
4f8551386af2 Do not ask `align' when html4-strict mode
HIROSE Yuuji <yuuji@gentei.org>
parents: 466
diff changeset
1710 "height" (yahtml-read-parameter "height"))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1711 (t
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
1712 ""))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1713
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1714 (defun yahtml:abbr ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1715 "Add-in function for abbr."
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1716 (yahtml-make-optional-argument "title" (yahtml-read-parameter "title")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1717
136
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1718 (defun yahtml:button ()
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1719 (concat
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1720 (yahtml-make-optional-argument
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1721 "name" (yahtml-read-parameter "name"))
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1722 (yahtml-make-optional-argument
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1723 "type" (yahtml-read-parameter
137
7919fbbb33c0 Add attribute value completion.
yuuji@gentei.org
parents: 136
diff changeset
1724 "type" "button" '(("submit")("reset")("button"))))
7919fbbb33c0 Add attribute value completion.
yuuji@gentei.org
parents: 136
diff changeset
1725 (yahtml-make-optional-argument
7919fbbb33c0 Add attribute value completion.
yuuji@gentei.org
parents: 136
diff changeset
1726 "value" (yahtml-read-parameter "value"))))
136
ab0c019da44d Add "button" element.
yuuji@gentei.org
parents: 135
diff changeset
1727
583
d4831b3672f8 Add some html5 elements
HIROSE Yuuji <yuuji@gentei.org>
parents: 573
diff changeset
1728 (defun yahtml::article ()
d4831b3672f8 Add some html5 elements
HIROSE Yuuji <yuuji@gentei.org>
parents: 573
diff changeset
1729 (setq yahtml-last-typeface-cmd "h1" yahtml-last-begend "h1"))
d4831b3672f8 Add some html5 elements
HIROSE Yuuji <yuuji@gentei.org>
parents: 573
diff changeset
1730
611
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1731 (defun yahtml:meter ()
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1732 (concat
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1733 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1734 "min" (yahtml-read-parameter "min"))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1735 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1736 "max" (yahtml-read-parameter "max"))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1737 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1738 "low" (yahtml-read-parameter "low"))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1739 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1740 "high" (yahtml-read-parameter "high"))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1741 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1742 "value" (yahtml-read-parameter "value"))))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1743
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1744 (defun yahtml:progress ()
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1745 (concat
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1746 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1747 "max" (yahtml-read-parameter "max"))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1748 (yahtml-make-optional-argument
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1749 "value" (yahtml-read-parameter "value"))))
e87c3271b8fd Add "meter" and "progress" completions
HIROSE Yuuji <yuuji@gentei.org>
parents: 607
diff changeset
1750
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1751 ;;; ---------- Simple tag ----------
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1752 (defun yahtml-insert-tag (region-mode &optional tag)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1753 "Insert <TAG> </TAG> and put cursor inside of them."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1754 (interactive "P")
392
c44910b36b95 Switch to region-mode if completion called with active region.
HIROSE Yuuji <yuuji@gentei.org>
parents: 366
diff changeset
1755 (setq yahtml-current-completion-type 'inline
c44910b36b95 Switch to region-mode if completion called with active region.
HIROSE Yuuji <yuuji@gentei.org>
parents: 366
diff changeset
1756 region-mode (or region-mode (YaTeX-region-active-p)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1757 (or tag
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1758 (let ((completion-ignore-case t))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1759 (setq tag
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1760 (YaTeX-cplread-with-learning
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1761 (format "Tag %s(default %s): "
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1762 (if region-mode "region: " "") yahtml-last-typeface-cmd)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1763 'yahtml-typeface-table 'yahtml-user-typeface-table
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1764 'yahtml-tmp-typeface-table))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1765 (if (string= "" tag) (setq tag yahtml-last-typeface-cmd))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1766 (setq tag (or (cdr (assoc tag yahtml-typeface-table)) tag))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1767 (setq yahtml-last-typeface-cmd tag
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1768 tag (funcall (if yahtml-prefer-upcases 'upcase 'downcase) tag))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1769 (if region-mode
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1770 (if (if (string< "19" emacs-version) (mark t) (mark))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1771 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1772 (if (> (point) (mark)) (exchange-point-and-mark))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1773 (insert (format "<%s%s>" tag (yahtml-addin tag)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1774 (exchange-point-and-mark)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1775 (insert "</" tag ">"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1776 (message "No mark set now"))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1777 (insert (format "<%s%s>" tag (yahtml-addin tag)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1778 (save-excursion (insert (format "</%s>" tag)))))
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
1779
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1780 (defun yahtml-insert-tag-region (&optional tag)
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1781 "Call yahtml-insert-tag with region mode."
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1782 (interactive)
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1783 (yahtml-insert-tag t tag))
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
1784
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1785 (defvar yahtml-need-single-closer nil) ;for test
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1786 (defun yahtml-insert-single (cmd)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1787 "Insert <CMD>."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1788 (interactive
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1789 (list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1790 (let ((completion-ignore-case t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1791 (YaTeX-cplread-with-learning
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1792 (format "Command%s: "
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1793 (if yahtml-last-single-cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1794 (concat "(default " yahtml-last-single-cmd ")") ""))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1795 'yahtml-single-cmd-table 'yahtml-user-single-cmd-table
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1796 'yahtml-tmp-single-cmd-table))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1797 (if (string= "" cmd) (setq cmd yahtml-last-single-cmd))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1798 (setq yahtml-last-single-cmd
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1799 (or (cdr (assoc cmd yahtml-single-cmd-table)) cmd))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1800 (setq cmd (funcall (if yahtml-prefer-upcases 'upcase 'downcase)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1801 yahtml-last-single-cmd))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1802 (insert (format "<%s%s%s>"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1803 cmd
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1804 (yahtml-addin cmd)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1805 (if (and yahtml-need-single-closer
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1806 (assoc cmd '(("br")("hr"))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1807 " /" "")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1808 (if (assoc cmd yahtml-env-table)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1809 (save-excursion (insert (format "</%s>" cmd)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1810
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1811 (defun yahtml-insert-p (&optional arg)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1812 "Convenient function to insert <p></p>"
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1813 (interactive "P")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1814 (if (or yahtml-always-/p arg) (yahtml-insert-tag arg "p")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1815 (yahtml-insert-single "p")))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1816
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1817 (defun yahtml-insert-amps (arg)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1818 "Insert char-entity references via ampersand"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1819 ;; Thanks; http://www.tsc.co.jp/~asada/html/wdg40_f/entities/
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1820 (interactive "P")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1821 (let*((mess "") c
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1822 (list (append yahtml-entity-reference-chars-alist-default
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1823 yahtml-entity-reference-chars-alist))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1824 (l list))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1825 (while l
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1826 (setq mess (format "%s %c" mess (car (car l)) (cdr (car l)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1827 l (cdr l)))
319
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1828 (message "Char-entity reference: %s SPC=& RET=&; BS=%s Other=&#..;"
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1829 mess (if YaTeX-japan "直前の文字" "Preceding-Char"))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1830 (setq c (read-char))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1831 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1832 ((equal c (car-safe (assoc c list)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1833 (insert (format "&%s;" (cdr (assoc c list)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1834 ((or (equal c ?\n) (equal c ?\r))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1835 (insert "&;")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1836 (forward-char -1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1837 ((equal c ? )
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1838 (insert ?&))
319
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1839 ((and (memq c '(127 8))
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1840 (setq c (preceding-char))
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1841 (delete-backward-char 1)
afe97f605d96 yahtml-insert-amps: `& BackSpace' translate preceding char to entity reference.
HIROSE Yuuji <yuuji@gentei.org>
parents: 315
diff changeset
1842 nil)) ;Fall through to the next 't block
320
HIROSE Yuuji <yuuji@gentei.org>
parents: 319
diff changeset
1843 (t (insert (format "&#x%x;" c))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1844
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1845 (defun yahtml:!--\#include ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1846 (let ((file (yahtml-read-parameter "file" "")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1847 (format "%s=\"%s\"--" (if (string-match "/" file) "virtual" "file") file)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1848
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1849 (defun yahtml:!--\#exec ()
147
f9d3c2451d19 get-builtin for yahtml
yuuji@gentei.org
parents: 145
diff changeset
1850 (format "cmd=\"%s\"--"
f9d3c2451d19 get-builtin for yahtml
yuuji@gentei.org
parents: 145
diff changeset
1851 (yahtml-read-parameter "cmd" "" '(("cmd" . command)))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1852
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1853 (defun yahtml:media-read-options (&optional opts-alist)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1854 (let*((delim " ")
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1855 (minibuffer-completion-table
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1856 (or opts-alist '(("autoplay") ("controls") ("loop") ("preload"))))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1857 (quotekey (substitute-command-keys "\\[quoted-insert]")))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1858 (read-from-minibuffer-with-history
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1859 (format "Media Opts(`%s SPC' for more options): " quotekey)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1860 "controls" YaTeX-minibuffer-completion-map)))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1861
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1862 (defun yahtml:audio ()
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1863 ;preload autoplay loop controls: `src' be specified via `source'
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1864 (yahtml:media-read-options))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1865
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1866 (defun yahtml:video ()
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1867 ;`src' be specified via `source'
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1868 (let ((poster (yahtml-make-optional-argument
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1869 "poster"
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1870 (yahtml-read-file-name-regexp
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1871 "Poster: " "\\.\\(gif\\|png\\|jpg\\|w?bmp\\|pict\\|tif\\)"
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1872 "")))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1873 (opts (yahtml:media-read-options)))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1874 (concat poster (if (string< "" opts) (concat " " opts)))))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1875
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1876 (defvar yahtml-media-file-regexp
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1877 "\\.\\(mp[0-9]\\|wav\\|og[gv]\\|opus\\|aac\\)"
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1878 "*Default filename regexp of media files.")
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1879
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1880 (defun yahtml:source ()
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1881 ;; source element must have src attribute
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1882 (format "src=\"%s\"" (yahtml-read-file-name-regexp
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
1883 "source: " yahtml-media-file-regexp "" "" nil "")))
459
5709236dafb3 Add :figure
HIROSE Yuuji <yuuji@gentei.org>
parents: 458
diff changeset
1884
5709236dafb3 Add :figure
HIROSE Yuuji <yuuji@gentei.org>
parents: 458
diff changeset
1885 (defun yahtml:figure ()
5709236dafb3 Add :figure
HIROSE Yuuji <yuuji@gentei.org>
parents: 458
diff changeset
1886 (setq yahtml-last-typeface-cmd "figcaption"))
5709236dafb3 Add :figure
HIROSE Yuuji <yuuji@gentei.org>
parents: 458
diff changeset
1887
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1888 (defun yahtml:iframe ()
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1889 (let ((src (yahtml-read-url "src: ")))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1890 (concat
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1891 (yahtml-make-optional-argument "src" src)
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1892 (yahtml-make-optional-argument
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1893 "width" (YaTeX-read-string-or-skip "width: "))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1894 (yahtml-make-optional-argument
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1895 "height" (YaTeX-read-string-or-skip "height: ")))))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
1896
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1897 ;;; ---------- Jump ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1898 (defun yahtml-on-href-p ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1899 "Check if point is on href clause."
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1900 (let ((p (point)) e cmd (case-fold-search t))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1901 (save-excursion
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1902 (and ;;(string= (YaTeX-inner-environment t) "a") ;aでなくても許可にした
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1903 (save-excursion
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1904 ;;(search-forward "</a>" nil t) ;aでなくても許可にした
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1905 (search-forward "[\" \t\n]" nil t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1906 (setq e (point)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1907 ;(goto-char (get 'YaTeX-inner-environment 'point))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1908 (re-search-backward "<\\(a\\|link\\)\\>" nil t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1909 (search-forward "href" e t)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1910 (search-forward "=" e t)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1911 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1912 (skip-chars-forward " \t\n")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1913 (looking-at "\"?\\([^\"> \t\n]+\\)\"?"))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1914 (< p (match-end 0))
153
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
1915 (yahtml-unescape-string (YaTeX-match-string 1))))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1916
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1917 (defun yahtml-netscape-sentinel (proc mes)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1918 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1919 ((null (buffer-name (process-buffer proc)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1920 (set-process-buffer proc nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1921 ((eq (process-status proc) 'exit)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1922 (let ((cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1923 (set-buffer (process-buffer proc))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1924 (goto-char (point-min))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1925 (if (search-forward "not running" nil t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1926 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1927 (message "Starting netscape...")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1928 (start-process
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1929 "browser" (process-buffer proc)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1930 shell-file-name yahtml-shell-command-option
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1931 (format "%s \"%s\"" yahtml-www-browser
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1932 (get 'yahtml-netscape-sentinel 'url)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1933 (message "Starting netscape...Done")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1934 (set-buffer cb)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1935
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1936 (defvar yahtml-browser-process nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1937
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1938 (defun yahtml-browse-html (href)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1939 "Call WWW Browser to see HREF."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1940 (let ((pb "* WWW Browser *") (cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1941 (cond
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1942 ((string-match "^start\\>" yahtml-www-browser)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1943 (if (get-buffer pb)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1944 (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1945 (put 'yahtml-netscape-sentinel 'url href)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1946 (set-process-sentinel
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1947 (setq yahtml-browser-process
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1948 (start-process
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1949 "browser" pb shell-file-name yahtml-shell-command-option
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1950 (format "%s \"%s\"" yahtml-www-browser href)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1951 'yahtml-netscape-sentinel))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1952 ((and (string-match
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1953 "[Nn]etscape\\|[Ff]irefox\\|[Mm]ozilla" yahtml-www-browser)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1954 (not (eq system-type 'windows-nt)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1955 (if (get-buffer pb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1956 (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1957 (put 'yahtml-netscape-sentinel 'url href)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1958 (set-process-sentinel
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1959 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1960 (start-process
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1961 "browser" pb shell-file-name yahtml-shell-command-option ;"-c"
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1962 (format "%s -remote \"openURL(%s)\"" yahtml-www-browser href)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1963 'yahtml-netscape-sentinel))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1964 ((and (string= "w3" yahtml-www-browser) (fboundp 'w3-fetch))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1965 (w3-fetch href))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1966 ((stringp yahtml-www-browser)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1967 (if (and yahtml-browser-process
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1968 (eq (process-status yahtml-browser-process) 'run))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1969 (message "%s is already running" yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1970 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1971 (start-process
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1972 "browser" "* WWW Browser *"
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1973 shell-file-name yahtml-shell-command-option
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1974 (format "%s \"%s\"" yahtml-www-browser href)))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1975 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1976 (message "Sorry, jump across http is not supported.")))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1977
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1978 (defun yahtml-goto-corresponding-href (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1979 "Go to corresponding name."
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
1980 (let ((href (yahtml-on-href-p)) file name (parent buffer-file-name))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1981 (if href
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1982 (cond
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1983 ((string-match "^\\(ht\\|f\\)tps?:" href)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
1984 (yahtml-browse-html href))
462
c940797c19ad href target of file should be untranslated before find-file
HIROSE Yuuji <yuuji@gentei.org>
parents: 459
diff changeset
1985 (t (if (string-match "\&" href)
c940797c19ad href target of file should be untranslated before find-file
HIROSE Yuuji <yuuji@gentei.org>
parents: 459
diff changeset
1986 (setq href (yahtml-untranslate-string href)))
c940797c19ad href target of file should be untranslated before find-file
HIROSE Yuuji <yuuji@gentei.org>
parents: 459
diff changeset
1987 (setq file (substring href 0 (string-match "#" href)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1988 (if (string-match "#" href)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1989 (setq name (substring href (1+ (string-match "#" href)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1990 (if (string< "" file)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1991 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
1992 (if (string-match "/$" file)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1993 (or (catch 'dirindex
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1994 (mapcar
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1995 (function
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1996 (lambda (f)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1997 (if (file-exists-p (concat file f))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1998 (throw 'dirindex
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1999 (setq file (concat file f))))))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2000 (yahtml-get-directory-index))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2001 nil)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2002 (setq file (concat file yahtml-directory-index))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2003 (if (string-match "^/" file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2004 (setq file (yahtml-url-to-path file)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2005 (if other (YaTeX-switch-to-buffer-other-window file)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2006 (YaTeX-switch-to-buffer file))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2007 (or YaTeX-parent-file (setq YaTeX-parent-file parent))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2008 (if name
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2009 (progn (set-mark-command nil) (yahtml-jump-to-name name)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2010 t)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2011
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2012 (defun yahtml-jump-to-name (name)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2013 "Jump to html's named tag."
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2014 (setq name (format "\\(name\\|id\\)\\s *=\\s *\"?%s\\>\"?" name))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2015 (or (and (re-search-forward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2016 (and (re-search-backward name nil t) (goto-char (match-beginning 0)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2017 (message "Named tag `%s' not found" (substring href 1))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2018
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2019 (defun yahtml-on-begend-p (&optional p)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2020 "Check if point is on begend clause."
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2021 (let ((p (or p (point))) cmd (case-fold-search t))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2022 (save-excursion
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2023 (goto-char p)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2024 (if (equal (char-after (point)) ?<) (forward-char 1))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2025 (if (and (re-search-backward "<" nil t)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2026 (looking-at
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2027 ;(concat "<\\(/?" yahtml-struct-name-regexp "\\)\\b")
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
2028 "<\\(/?[A-Z][A-Z0-9]*\\)\\b")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2029 (condition-case nil
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2030 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2031 (error nil))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2032 (< p (point)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2033 (YaTeX-match-string 1)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2034
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2035 (defun yahtml-goto-corresponding-begend (&optional noerr)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2036 "Go to corresponding opening/closing tag.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2037 Optional argument NOERR causes no error for unballanced tag."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2038 (let ((cmd (yahtml-on-begend-p)) m0
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2039 (p (point)) (case-fold-search t) func str (nest 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2040 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2041 (cmd
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2042 (setq m0 (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2043 (if (= (aref cmd 0) ?/) ;on </cmd> line
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2044 (setq cmd (substring cmd 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2045 str (format "\\(<%s\\)\\|\\(</%s\\)" cmd cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2046 func 're-search-backward)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2047 (setq str (format "\\(</%s\\)\\|\\(<%s\\)" cmd cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2048 func 're-search-forward))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2049 (while (and (>= nest 0) (funcall func str nil t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2050 (if (equal m0 (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2051 nil
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2052 (setq nest (+ nest (if (match-beginning 1) -1 1)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2053 (if (< nest 0)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2054 (goto-char (match-beginning 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2055 (funcall
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2056 (if noerr 'message 'error)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2057 "Corresponding tag of `%s' not found." cmd)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2058 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2059 nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2060 (t nil))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2061
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2062 (defun yahtml-current-tag ()
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2063 "Return the current tag name including #exec and #include."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2064 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2065 (let ((p (point)) b tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2066 (or (bobp)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2067 (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2068 (progn (skip-chars-backward "^<") (forward-char -1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2069 (setq b (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2070 (skip-chars-forward "<")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2071 (setq tag (YaTeX-buffer-substring
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2072 (point) (progn (skip-chars-forward "^ \t\n") (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2073 (goto-char b)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2074 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2075 (and (< p (point)) tag))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2076
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2077 (defun yahtml-get-attrvalue (attr)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2078 "Extract current tag's attribute value from buffer."
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2079 (let (e (case-fold-search t))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2080 (save-excursion
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2081 (or (looking-at "<")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2082 (progn (skip-chars-backward "^<") (backward-char 1)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2083 (setq e (save-excursion (forward-list 1) (point)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2084 (if (and
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2085 (re-search-forward (concat "\\b" attr "\\b") e t)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2086 (progn (skip-chars-forward " \t\n=")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2087 (looking-at "\"?\\([^\"> \t\n]+\\)\"?")))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2088 (YaTeX-match-string 1)))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2089
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2090 (defun yahtml-goto-corresponding-img ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2091 "View image on point"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2092 (let ((tag (yahtml-current-tag)) image (p (point)) (case-fold-search t))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2093 (if (and tag
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2094 (string-match "img" tag)
153
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
2095 (setq image
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
2096 (yahtml-unescape-string (yahtml-get-attrvalue "src"))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2097 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2098 (message "Invoking %s %s..." yahtml-image-viewer image)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2099 (start-process
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2100 "Viewer" " * Image Viewer *"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2101 shell-file-name yahtml-shell-command-option ;"-c"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2102 (concat yahtml-image-viewer " " image))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2103 (message "Invoking %s %s...Done" yahtml-image-viewer image)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2104
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2105 (defun yahtml-goto-corresponding-source (&optional other)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2106 "Goto applet's or script's source."
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2107 (let ((env (yahtml-current-tag)) s (p (point)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2108 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2109 ((string-match "applet" env)
153
207f0b4af9df Unescape URL strings from buffer(yahtml-unescape-string).
yuuji@gentei.org
parents: 147
diff changeset
2110 (if (setq s (yahtml-unescape-string (yahtml-get-attrvalue "code")))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2111 (progn
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2112 (setq s (YaTeX-match-string 1)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2113 s (concat
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2114 (substring s 0 (string-match "\\.[A-Za-z]+$" s))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2115 ".java"))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2116 (if other (YaTeX-switch-to-buffer-other-window s)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2117 (YaTeX-switch-to-buffer s))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2118 s) ;return source file name
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2119 (message "No applet source specified")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2120 (sit-for 1)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2121 nil))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2122 ((string-match "script" env)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2123 (if (setq s (yahtml-get-attrvalue "src"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2124 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2125 (funcall (if other 'YaTeX-switch-to-buffer-other-window
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2126 'YaTeX-switch-to-buffer)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2127 (yahtml-url-to-path s))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2128 s)))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2129 ((string-match "!--#include" env)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2130 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2131 ((setq s (yahtml-get-attrvalue "file")) ;<!--#include file="foo"-->
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2132 (if other (YaTeX-switch-to-buffer-other-window s)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2133 (YaTeX-switch-to-buffer s))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2134 s)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2135 ((setq s (yahtml-get-attrvalue "virtual"));<!--#include virtual="foo"-->
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2136 (setq s (yahtml-url-to-path s))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2137 (if other (YaTeX-switch-to-buffer-other-window s)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2138 (YaTeX-switch-to-buffer s))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2139 s)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2140 ((and (string-match "!--#exec" env)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2141 (setq s (yahtml-get-attrvalue "cmd")))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2142 (setq s (substring s 0 (string-match " \t\\?" s))) ;get argv0
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2143 (let ((b " *yahtmltmp*")) ;peek a little
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2144 (unwind-protect
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2145 (progn
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2146 (set-buffer (get-buffer-create b))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2147 (YaTeX-insert-file-contents s nil 0 100)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2148 (if (looking-at "#!")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2149 (if other (YaTeX-switch-to-buffer-other-window s)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2150 (YaTeX-switch-to-buffer s))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2151 (kill-buffer (get-buffer b)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2152 (get-file-buffer s))))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2153
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2154 (defun yahtml-goto-corresponding-* (&optional other)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2155 "Go to corresponding object."
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2156 (interactive "P")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2157 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2158 ((yahtml-goto-corresponding-href other))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2159 ((yahtml-goto-corresponding-img))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2160 ((yahtml-goto-corresponding-source other))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2161 ((yahtml-goto-corresponding-begend))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
2162 (t (message "I don't know where to go."))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2163
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2164 (defun yahtml-goto-corresponding-*-other-window ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2165 "Go to corresponding object."
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2166 (interactive)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2167 (yahtml-goto-corresponding-* t))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2168
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2169 (defun yahtml-visit-main ()
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2170 "Go to parent file from where you visit current file."
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2171 (interactive)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2172 (if YaTeX-parent-file (YaTeX-switch-to-buffer YaTeX-parent-file)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2173
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2174 ;;; ---------- killing ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2175 (defun yahtml-kill-begend (&optional whole)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2176 (let ((tag (yahtml-on-begend-p)) p q r bbolp)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2177 (if tag
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2178 (save-excursion
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2179 (or (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2180 (progn (skip-chars-backward "^<") (forward-char -1)))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2181 (setq p (point))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2182 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2183 (or (looking-at "<")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2184 (progn (skip-chars-backward "^<") (forward-char -1)))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2185 (if (< (point) p) ;if on the opening tag
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2186 (progn (setq q p p (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2187 (goto-char q))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2188 (setq q (point))) ;now q has end-line's (point)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2189 (if (not whole)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2190 (kill-region
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2191 (progn (skip-chars-backward " \t")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2192 (if (setq bbolp (bolp)) (point) q))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2193 (progn (forward-list 1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2194 (setq r (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2195 (skip-chars-forward " \t")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2196 (if (and bbolp (eolp) (not (eobp))) (1+ (point)) r))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2197 (goto-char p)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2198 (skip-chars-backward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2199 (if (not whole)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2200 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2201 (kill-append
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2202 (buffer-substring
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2203 (setq p (if (setq bbolp (bolp)) (point) p))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2204 (setq q (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2205 (forward-list 1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2206 (setq r (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2207 (skip-chars-forward " \t")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2208 (if (and bbolp (eolp) (not (eobp)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2209 (1+ (point))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2210 r))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2211 t)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2212 (delete-region p q))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2213 (kill-region
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2214 (if (bolp) (point) p)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2215 (progn (goto-char q)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2216 (forward-list 1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2217 (setq r (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2218 (skip-chars-forward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2219 (if (and (eolp) (not (eobp))) (1+ (point)) r))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2220 tag))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2221
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2222 (defun yahtml-kill-* (whole)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2223 "Kill current position's HTML tag (set)."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2224 (interactive "P")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2225 (cond
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
2226 ((yahtml-kill-begend whole))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2227
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2228
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2229 ;;; ---------- changing ----------
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2230 (defun yahtml-on-assignment-p ()
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2231 "Return if current point is on parameter assignment.
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2232 If so, return parameter name, otherwise nil.
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2233 This function should be able to treat white spaces in value, but not yet."
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2234 (let ((p (point)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2235 (save-excursion
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2236 (put 'yahtml-on-assignment-p 'region nil)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2237 (skip-chars-backward "^ \t\n")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2238 (and (looking-at "\\([A-Za-z0-9]+\\)\\s *=\\s *\"?\\([^ \t\"]+\\)\"?")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2239 (< p (match-end 0))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2240 (>= p (1- (match-beginning 2)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2241 (put 'yahtml-on-assignment-p 'region
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2242 (cons (match-beginning 2) (match-end 2)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2243 (YaTeX-match-string 1)))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2244
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2245 (defun yahtml-change-begend ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2246 (let ((tag (yahtml-on-begend-p))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2247 (completion-ignore-case t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2248 (case-fold-search t)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2249 (p (point)) (q (make-marker))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2250 (default (append yahtml-env-table yahtml-typeface-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2251 (user (append yahtml-user-env-table yahtml-user-typeface-table))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2252 (tmp (append yahtml-tmp-env-table yahtml-tmp-typeface-table))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2253 href b1 e1 attr new css)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2254 (cond
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2255 (tag
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2256 (cond
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2257 ((and (string-match "^a$" tag)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2258 (save-excursion
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2259 (and
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2260 (re-search-backward "<a\\b" nil t)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2261 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2262 (goto-char (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2263 (skip-chars-forward " \t\n")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2264 (setq b1 (point))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2265 (search-forward ">" nil t))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2266 (setq e1 (match-beginning 0))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2267 (goto-char b1)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2268 (re-search-forward "href\\s *=" e1 t)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2269 (>= p (point))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2270 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2271 (goto-char (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2272 (skip-chars-forward " \t\n")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2273 (looking-at "\"?\\([^\"> \t\n]+\\)\"?"))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2274 (< p (match-end 0)))))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2275 (setq b1 (match-beginning 1) e1 (match-end 1)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2276 yahtml-completing-buffer (current-buffer)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2277 ;; yahtml-urls-local is buffer-local, so we must put
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2278 ;; that into yahtml-urls here
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2279 yahtml-urls (append yahtml-urls-private yahtml-urls-local)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2280 href (read-from-minibuffer
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2281 "Change href to: " "" yahtml-url-completion-map))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2282 (if (string< "" href)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2283 (progn
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2284 ;;(setq href ;??
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2285 ;; (if yahtml-prefer-upcases (upcase href) (downcase href)))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2286 (delete-region b1 e1)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2287 (goto-char b1)
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2288 (insert href))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2289 ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2290 (if (and (equal attr "class") ;treat "class" attribute specially
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2291 (setq css (yahtml-css-get-element-completion-alist tag)))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2292
396
2fc714f03ddf Clarify which element the current class name completions for
HIROSE Yuuji <yuuji@gentei.org>
parents: 394
diff changeset
2293 (setq new (yahtml-read-css css tag))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2294 ;;other than "class", read parameter normally
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2295 (setq new (yahtml-read-parameter attr)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2296 (goto-char (car (get 'yahtml-on-assignment-p 'region)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2297 (delete-region (point) (cdr (get 'yahtml-on-assignment-p 'region)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2298 (insert new))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2299 (t
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2300 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2301 (if (= (aref tag 0) ?/) (setq tag (substring tag 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2302 (or (= (char-after (point)) ?<) (skip-chars-backward "^<"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2303 (skip-chars-forward "^A-Za-z")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2304 (set-marker q (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2305 (setq p (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2306 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2307 (or (= (char-after (point)) ?<)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2308 (skip-chars-backward "^<"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2309 (skip-chars-forward "^A-Za-z")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2310 (if (= (char-after (1- (point))) ?/)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2311 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2312 (set-marker q (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2313 (goto-char p)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2314 (setq tag (let ((completion-ignore-case t))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2315 (YaTeX-cplread-with-learning
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2316 (format "Change `%s' to(default %s): "
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2317 tag yahtml-last-begend)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2318 'default 'user 'tmp)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2319 (delete-region (point) (progn (skip-chars-forward "^>") (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2320 (if (string= "" tag) (setq tag yahtml-last-begend))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2321 (setq yahtml-last-begend
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2322 (or (cdr (assoc tag yahtml-env-table)) tag)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2323 tag yahtml-last-begend)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2324 (setq tag (if yahtml-prefer-upcases (upcase tag) (downcase tag)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2325 (insert (format "%s%s" tag (yahtml-addin tag)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2326 (goto-char q)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2327 (set-marker q nil)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2328 (delete-region (point) (progn (skip-chars-forward "^>") (point)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2329 (insert tag))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2330 t))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2331
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2332 (defun yahtml-change-command ()
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2333 (let ((p (point)) (case-fold-search t) cmd par new
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2334 (beg (make-marker)) (end (make-marker)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2335 (skip-chars-backward "^<")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2336 (if (and
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2337 (looking-at yahtml-command-regexp)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2338 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2339 (set-marker beg (match-beginning 0))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2340 (set-marker end (match-end 0))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2341 t) ;for further work
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2342 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2343 (forward-char -1)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2344 (condition-case nil
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2345 (forward-list 1)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2346 (error nil))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2347 (< p (point))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2348 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2349 (goto-char p)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2350 (if (setq par (yahtml-on-assignment-p))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2351 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2352 (setq new (yahtml-read-parameter par))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2353 (set-marker beg (car (get 'yahtml-on-assignment-p 'region)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2354 (set-marker end (cdr (get 'yahtml-on-assignment-p 'region))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2355 (setq new
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2356 (YaTeX-cplread-with-learning
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2357 "Change form to: "
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2358 'yahtml-form-table 'yahtml-user-form-table
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2359 'yahtml-tmp-form-table)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2360 (delete-region beg end)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2361 (goto-char beg)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2362 (set-marker beg nil)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2363 (set-marker end nil)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2364 (insert new)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2365 t)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2366 (goto-char p)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2367 nil)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2368
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2369 (defun yahtml-change-* ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2370 "Change current position's HTML tag (set)."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2371 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2372 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2373 ((yahtml-change-begend))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
2374 ((yahtml-change-command))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2375
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2376 ;;; ---------- commenting ----------
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2377
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2378 (defun yahtml-comment-region (&optional uncom)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2379 "Comment out region or environment."
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2380 (interactive)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2381 (let ((e (make-marker)) be beg p)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2382 (cond
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2383 (;(marker-position (set-marker e (yahtml-on-begend-p)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2384 (setq be (yahtml-on-begend-p))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2385 (save-excursion
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2386 (setq p (point))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2387 (if (string-match "^/" be)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2388 (setq beg (progn (forward-line 1) (point)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2389 (setq beg (progn (beginning-of-line) (point))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2390 (goto-char p)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2391 (yahtml-goto-corresponding-begend)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2392 (if (string-match "^/" be)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2393 (beginning-of-line)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2394 (forward-line 1))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2395 (set-marker e (point))
102
4be83051f641 Documentation fix.
yuuji@gentei.org
parents: 88
diff changeset
2396 ;(comment-region beg (point) (if uncom (list 4)))))
103
f2f0d1eedd39 Broken parens' balance, fixed.
yuuji@gentei.org
parents: 102
diff changeset
2397 ))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2398 (t ;(comment-region (region-beginning) (region-end) (if uncom (list 4)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2399 (setq beg (region-beginning))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2400 (set-marker e (region-end))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2401 (if yahtml-translate-hyphens-when-comment-region
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2402 (let ((yahtml-entity-reference-chars-alist-default nil)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2403 (yahtml-entity-reference-chars-alist '((?- . "#45")))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2404 yahtml-entity-reference-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2405 yahtml-entity-reference-chars-reverse-regexp)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2406 (yahtml-entity-reference-chars-setup)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2407 (funcall
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2408 (if uncom 'yahtml-translate-reverse-region
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2409 'yahtml-translate-region)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2410 beg e)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2411 (comment-region beg e (if uncom (list 4)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2412 (set-marker e nil)))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2413
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2414 (defun yahtml-uncomment-region ()
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2415 (interactive)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2416 (yahtml-comment-region t))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2417
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2418 ;;; ---------- translate to entity references ----------
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2419 (defvar yahtml-entity-reference-chars-alist-default
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2420 ;'((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot") (?' . "apos"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2421 '((?> . "gt") (?< . "lt") (?& . "amp") (?\" . "quot"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2422 "Default translation table from character to entity reference")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2423 (defvar yahtml-entity-reference-chars-alist nil
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2424 "*Translation table from character to entity reference")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2425 (defvar yahtml-entity-reference-chars-regexp nil)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2426 (defvar yahtml-entity-reference-chars-reverse-regexp nil)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2427
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2428 (defun yahtml-entity-reference-chars-setup ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2429 (let ((list (append yahtml-entity-reference-chars-alist-default
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2430 yahtml-entity-reference-chars-alist)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2431 (setq yahtml-entity-reference-chars-regexp "["
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2432 yahtml-entity-reference-chars-reverse-regexp "&\\(")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2433 (while list
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2434 (setq yahtml-entity-reference-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2435 (concat yahtml-entity-reference-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2436 (char-to-string (car (car list))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2437 yahtml-entity-reference-chars-reverse-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2438 (concat yahtml-entity-reference-chars-reverse-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2439 (cdr (car list))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2440 (if (cdr list) "\\|")))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2441 (setq list (cdr list)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2442 (setq yahtml-entity-reference-chars-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2443 (concat yahtml-entity-reference-chars-regexp "]")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2444 yahtml-entity-reference-chars-reverse-regexp
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2445 (concat yahtml-entity-reference-chars-reverse-regexp "\\);"))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2446
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2447 (yahtml-entity-reference-chars-setup)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2448
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2449 (defun yahtml-translate-region (beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2450 "Translate inhibited literals."
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2451 (interactive "r")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2452 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2453 (save-restriction
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2454 (narrow-to-region beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2455 (let ((ct (append yahtml-entity-reference-chars-alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2456 yahtml-entity-reference-chars-alist-default)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2457 (goto-char beg)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2458 (while (re-search-forward yahtml-entity-reference-chars-regexp nil t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2459 ;(setq c (preceding-char))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2460 (replace-match
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2461 (concat "&" (cdr (assoc (preceding-char) ct)) ";")))))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2462
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2463 (defun yahtml-translate-reverse-region (beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2464 "Translate entity references to literals."
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2465 (interactive "r")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2466 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2467 (save-restriction
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2468 (narrow-to-region beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2469 (let ((ct (append yahtml-entity-reference-chars-alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2470 yahtml-entity-reference-chars-alist-default))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2471 ec)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2472 (goto-char beg)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2473 (while (re-search-forward
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2474 yahtml-entity-reference-chars-reverse-regexp nil t)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2475 ;(setq c (preceding-char))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2476 (setq ec (YaTeX-match-string 1))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2477 (delete-region (match-end 0) (match-beginning 0))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2478 (insert (car (YaTeX-rassoc ec ct))))))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
2479
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2480 (defun yahtml-inner-environment-but (exclude &optional quick)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2481 "Return the inner environment but matches with EXCLUDE tag."
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2482 (let (e (case-fold-search t))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2483 (save-excursion
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2484 (while (and (setq e (YaTeX-inner-environment quick))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2485 (string-match exclude e))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2486 (goto-char (get 'YaTeX-inner-environment 'point))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2487 e))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2488
145
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2489 (defun yahtml-untranslate-string (str)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2490 "Untranslate entity reference."
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2491 (let ((md (match-data)) (left "") (right str) b0 ch
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2492 (ct (append yahtml-entity-reference-chars-alist
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2493 yahtml-entity-reference-chars-alist-default))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2494 (revrex yahtml-entity-reference-chars-reverse-regexp))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2495 (unwind-protect
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2496 (progn
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2497 (while (string< "" right)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2498 (cond
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2499 ((string-match revrex right)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2500 (setq ch (YaTeX-rassoc
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2501 (substring right (match-beginning 1) (match-end 1)))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2502 b0 (substring right 0 (match-beginning 0))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2503 right (substring right (match-end 0))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2504 left (concat left
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2505 (substring right 0 (match-beginning 0))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2506 (char-to-string ch))))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2507 ((string-match "\\&#\\(x\\)?\\([0-9a-f]+\\);" right)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2508 (setq ch (substring right (match-beginning 2) (match-end 2))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2509 b0 (substring right 0 (match-beginning 0))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2510 right (substring right (match-end 0))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2511 left (concat left
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2512 b0
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2513 (char-to-string
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2514 (if (match-beginning 1)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2515 (YaTeX-hex ch)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2516 (string-to-number ch))))))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2517 (t (setq left (concat left right)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2518 right ""))))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2519 left)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2520 (store-match-data md))))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2521
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2522 ;;; ---------- table-ize region ----------
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2523 (defun yahtml-td-region (e delim beg end)
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2524 "Enclose each item in a region with <td>..</td>.
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2525 Interactive prefix argument consults enclosing element other than td."
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2526 (interactive "P\nsDelimiter(s): \nr")
156
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2527 (let ((e (cond
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2528 ((null e) "td")
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2529 ((stringp e) e)
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
2530 (t (read-string-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
2531 "Enclose with(`thd' means th td td..): " "th"))))
157
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2532 (ws "[ \t]")
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2533 elm p i)
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2534 (if (string= delim "") (setq delim " \t\n"))
157
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2535 (setq delim (concat "[" delim "]+")
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2536 elm (if (string= "thd" e)
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2537 (cons "th" "td")
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2538 (cons e e)))
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2539 (save-excursion
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2540 (save-restriction
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2541 (narrow-to-region beg end)
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2542 (goto-char (setq p (point-min)))
157
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2543 (setq i 0 e (car elm))
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2544 (while (re-search-forward delim nil t)
157
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2545 (setq e (if (= (setq i (1+ i)) 1) (car elm) (cdr elm)))
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2546 (goto-char (match-beginning 0))
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2547 (insert "</" e ">")
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2548 (save-excursion
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2549 (goto-char p)
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2550 (insert "<" e ">"))
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2551 (setq p (point))
155
4fd09665b2be yahtml-tr-region(): Allow null field (eg. ,,) in CSV.
yuuji@gentei.org
parents: 154
diff changeset
2552 (while (and (not (eobp)) (looking-at ws))
4fd09665b2be yahtml-tr-region(): Allow null field (eg. ,,) in CSV.
yuuji@gentei.org
parents: 154
diff changeset
2553 (delete-char 1))
4fd09665b2be yahtml-tr-region(): Allow null field (eg. ,,) in CSV.
yuuji@gentei.org
parents: 154
diff changeset
2554 (if (looking-at delim) (delete-char 1)))
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2555 (insert "<" e ">")
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2556 (goto-char (point-max))
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2557 (insert "</" e ">")))))
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2558
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2559 (defun yahtml-tr-region (e delim beg end)
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2560 "Enclose lines in a form tab-sv/csv with <tr><td>..</td></tr>."
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2561 (interactive "P\nsDelimiter(s): \nr")
157
e3d7307f71e0 yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
yuuji@gentei.org
parents: 156
diff changeset
2562 (setq e (if (and e (listp e))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
2563 (read-string-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
2564 "Enclose with(td or th, `thd' -> th td td td...: " "th")))
156
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2565 (save-excursion
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2566 (save-restriction
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2567 (narrow-to-region (point) (mark))
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2568 (goto-char (point-min))
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2569 (while (not (eobp))
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2570 (insert "<tr>")
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2571 (yahtml-td-region e delim (point) (point-end-of-line))
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2572 (end-of-line)
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2573 (insert "</tr>")
9b5c19e860d8 Simplify codes.
yuuji@gentei.org
parents: 155
diff changeset
2574 (forward-line 1)))))
154
d3bcc4e2166a Two new function added.
yuuji@gentei.org
parents: 153
diff changeset
2575
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2576 ;;; ---------- filling ----------
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2577 (defvar yahtml-saved-move-to-column (symbol-function 'move-to-column))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2578 (defun yahtml-move-to-column (col &optional force)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2579 (beginning-of-line)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2580 (let ((ccol 0))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2581 (while (and (> col ccol) (not (eolp)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2582 (if (eq (following-char) ?\<)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2583 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2584 (while (and (not (eq (following-char) ?\>))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2585 (not (eolp)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2586 (forward-char))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2587 (or (eolp) (forward-char)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2588 (or (eolp) (forward-char))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2589 (if (eq (preceding-char) ?\t)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2590 (let ((wd (- 8 (% (+ ccol 8) 8))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2591 (if (and force (< col (+ ccol wd)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2592 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2593 (backward-char 1)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2594 (insert-char ?\ (- col ccol))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2595 (setq ccol col))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2596 (setq ccol (+ ccol wd))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2597 (setq ccol (1+ ccol)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2598 (if (and YaTeX-japan
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2599 (or
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2600 (and (fboundp 'char-category)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2601 (string-match "[chj]" (char-category (preceding-char))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2602 (and (fboundp 'char-charset)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2603 (not (eq (char-charset (preceding-char)) 'ascii)))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2604 (setq ccol (1+ ccol)))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2605 (if (and force (> col ccol))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2606 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2607 (insert-char ?\ (- col ccol))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2608 col)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2609 ccol)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2610
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2611 (defun yahtml-fill-paragraph (arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2612 (interactive "P")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2613 (let*((case-fold-search t) (p (point)) fill-prefix
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2614 (e (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t) "html"))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2615 indent
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2616 (startp (get 'YaTeX-inner-environment 'point))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2617 (prep (string-match "^pre$" e))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2618 (ps1 (if prep (default-value 'paragraph-start)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2619 paragraph-start))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2620 (ps2 (if prep (concat (default-value 'paragraph-start)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2621 "$\\|^\\s *</?pre>")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2622 paragraph-start)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2623 (save-excursion
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2624 (unwind-protect
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2625 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2626 (if prep
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2627 (fset 'move-to-column 'yahtml-move-to-column))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2628 (save-excursion
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2629 (beginning-of-line)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2630 (indent-to-column (yahtml-this-indent))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2631 (setq fill-prefix
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2632 (buffer-substring (point) (point-beginning-of-line)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2633 (delete-region (point) (point-beginning-of-line)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2634 (fill-region-as-paragraph
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2635 (progn (re-search-backward paragraph-start nil t)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2636 (or (save-excursion
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2637 (goto-char (match-beginning 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2638 (if (looking-at "<")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2639 (forward-list)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2640 (goto-char (match-end 0))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2641 (skip-chars-forward " \t>"))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2642 (if (looking-at "[ \t]*$")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2643 (progn (forward-line 1) (point))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2644 (point)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2645 (progn (goto-char p)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2646 (re-search-forward ps2 nil t)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
2647 (match-beginning 0))))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2648 (fset 'move-to-column yahtml-saved-move-to-column)))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2649
359
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2650 ;;;
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2651 ;;; ---------- move forward/backward field ----------
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2652 ;;;
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2653 (defun yahtml-element-path ()
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2654 "Return the element path from <body> at point as a list"
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2655 (let (path elm)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2656 (save-excursion
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2657 (while (and (YaTeX-beginning-of-environment)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2658 (looking-at (concat "<\\(" yahtml-command-regexp "\\)\\>"))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2659 (not (string= (setq elm (downcase (YaTeX-match-string 1)))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2660 "body")))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2661 (setq path (cons elm path)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2662 elm nil))
411
a4a2635c5158 yahtml-element-path works correctly on `body'-less document
HIROSE Yuuji <yuuji@gentei.org>
parents: 409
diff changeset
2663 (and elm (setq path (cons elm path)))
a4a2635c5158 yahtml-element-path works correctly on `body'-less document
HIROSE Yuuji <yuuji@gentei.org>
parents: 409
diff changeset
2664 path)))
359
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2665
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2666 (defun yahtml-forward-field (arg)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2667 "Move ARGth forward cell to table element.
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2668 ENVINFO is a cons of target element name and its beginning point."
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2669 (interactive "p")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2670 (let (inenv elm path sibs)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2671 (cond
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2672 ((< arg 0) (yahtml-backward-field (- arg)))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2673 ((= arg 0) nil)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2674 ((and (setq path (nreverse (yahtml-element-path)))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2675 (catch 'sibling
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2676 (while path
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2677 (if (setq elm (car-safe
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2678 (member (car path) '("td" "th" "li" "dt" "dd"))))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2679 (throw 'sibling elm))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2680 (setq path (cdr path)))))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2681 (setq inenv (YaTeX-in-environment-p elm)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2682 sibs (cdr (assoc elm '(("td" . "td\\|th")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2683 ("th" . "td\\|th")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2684 ("li" . "li")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2685 ("dt" . "dt\\|dd")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2686 ("dd" . "dt\\|dd")))))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2687 (goto-char (cdr inenv))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2688 (while (>= (setq arg (1- arg)) 0)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2689 (yahtml-goto-corresponding-begend)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2690 (if (looking-at "<") (forward-list 1))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2691 (skip-chars-forward "^<"))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2692 (while (looking-at "\\s \\|\\(</\\)")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2693 (if (match-beginning 1) (forward-list 1)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2694 (skip-chars-forward "\n\t ")))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2695 (forward-list 1) ;; step into environment
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2696 (skip-chars-forward " \t\n")
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2697 (if (looking-at (concat "<\\(" sibs "\\)\\>"))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2698 (forward-list 1))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2699 ))))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2700
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2701
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2702 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2703 ;;; ---------- indentation ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2704 ;;;
359
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2705 (defun yahtml-indent-line-1 ()
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2706 "Indent a line (faster wrapper)"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2707 (interactive)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2708 (let (indent)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2709 (if (and (save-excursion
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2710 (beginning-of-line) (skip-chars-forward "\t ")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2711 (not (looking-at "<")))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2712 (save-excursion
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2713 (forward-line -1)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2714 (while (and (not (bobp)) (looking-at "^\\s *$"))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2715 (forward-line -1))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2716 (skip-chars-forward "\t ")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2717 (setq indent (current-column))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2718 (not (looking-at "<"))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2719 (progn
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2720 (save-excursion
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2721 (beginning-of-line)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2722 (skip-chars-forward " \t")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2723 (or (= (current-column) indent)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2724 (YaTeX-reindent indent)))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2725 (and (bolp) (skip-chars-forward " \t")))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2726 (yahtml-indent-line-real))))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2727
359
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2728 (defun yahtml-indent-line ()
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2729 "Indent a line (Second level wrapper).
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2730 See also yahtml-indent-line-1 and yahtml-indent-line-real."
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2731 (interactive)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2732 (let ((cc (current-column)) (p (point)))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2733 (yahtml-indent-line-1)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2734 (and (= cc (current-column))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2735 (= p (point))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2736 (equal last-command 'yahtml-indent-line)
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2737 (yahtml-forward-field 1))))
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2738
dbef6cf84f98 Two or more consecutive [Tab] in column of table jump to the next column.
HIROSE Yuuji <yuuji@gentei.org>
parents: 353
diff changeset
2739
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2740 (defun yahtml-this-indent ()
190
3db120d6b7d1 Calculation of indentation depth revised. (included again after merge conflict)
yuuji@gentei.org
parents: 189
diff changeset
2741 (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li")
3db120d6b7d1 Calculation of indentation depth revised. (included again after merge conflict)
yuuji@gentei.org
parents: 189
diff changeset
2742 (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$")
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2743 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2744 (excludes
190
3db120d6b7d1 Calculation of indentation depth revised. (included again after merge conflict)
yuuji@gentei.org
parents: 189
diff changeset
2745 "\\b\\(a\\|p\\|span\\|code\\|tt\\|em\\|u\\|i\\|big\\|small\\|font\\)\\b")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2746 inenv p col peol (case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2747 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2748 (beginning-of-line)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2749 (setq inenv (or (yahtml-inner-environment-but excludes t)
61
b9f753846b6b Bug fix release
yuuji
parents: 60
diff changeset
2750 "html")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2751 col (get 'YaTeX-inner-environment 'indent)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2752 p (get 'YaTeX-inner-environment 'point)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2753 op nil))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2754 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2755 (cond
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2756 ((string-match (concat "^\\(" envs "\\)") inenv)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2757 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2758 (beginning-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2759 (skip-chars-forward " \t")
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2760 (cond ;lookup current line's tag
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2761 ((looking-at (concat "</\\(" envs "\\)>"))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2762 col)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2763 ((looking-at itms)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2764 (+ col yahtml-environment-indent))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2765 ((and yahtml-hate-too-deep-indentation
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2766 (looking-at (concat "<\\(" envs "\\)")))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2767 (+ col (* 2 yahtml-environment-indent)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2768 ((and (< p (point))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2769 (string-match itemizing-envs inenv)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2770 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2771 (and
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2772 (setq op (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2773 (goto-char p)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2774 (re-search-forward itms op t)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2775 (progn
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2776 (if yahtml-indent-listing-constant
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2777 (setq col (+ (current-column)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2778 (if yahtml-faithful-to-htmllint 1 2)))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2779 (skip-chars-forward "^>")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2780 (skip-chars-forward ">")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2781 (skip-chars-forward " \t")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2782 (setq col (if (looking-at "$")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2783 (+ col yahtml-environment-indent)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2784 (current-column))))))))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2785 col)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2786 (t
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2787 (+ col yahtml-environment-indent)))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2788 (t col)))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2789
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2790 (defun yahtml-indent-line-real ()
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2791 "Indent current line."
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2792 (interactive)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2793 (YaTeX-reindent (yahtml-this-indent))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2794 (if (bolp) (skip-chars-forward " \t"))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
2795 (let (peol col inenv)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2796 (if (and (setq inenv (yahtml-on-begend-p))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2797 (string-match
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2798 (concat "^\\<\\(" yahtml-struct-name-regexp "\\)") inenv))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2799 (save-excursion
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2800 (setq peol (point-end-of-line))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2801 (or (= (char-after (point)) ?<)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2802 (progn (skip-chars-backward "^<") (forward-char -1)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2803 (setq col (current-column))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2804 (if (and (yahtml-goto-corresponding-begend t)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2805 (> (point) peol)) ;if on the different line
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2806 (YaTeX-reindent col))))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2807
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2808 ;(defun yahtml-fill-item ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2809 ; "Fill item HTML version"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2810 ; (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2811 ; (let (inenv p fill-prefix peol (case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2812 ; (setq inenv (or (YaTeX-inner-environment) "html")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2813 ; p (get 'YaTeX-inner-environment 'point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2814 ; (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2815 ; ((string-match "^[uod]l" inenv)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2816 ; (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2817 ; (if (re-search-backward "<\\(d[td]\\|li\\)>[ \t\n]*" p t)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2818 ; (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2819 ; (goto-char (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2820 ; (setq col (current-column)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2821 ; (error "No <li>, <dt>, <dd>")))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2822 ; (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2823 ; (end-of-line)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2824 ; (setq peol (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2825 ; (newline)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2826 ; (indent-to-column col)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2827 ; (setq fill-prefix (buffer-substring (point) (1+ peol)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2828 ; (delete-region (point) peol)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2829 ; (fill-region-as-paragraph
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2830 ; (progn (re-search-backward paragraph-start nil t) (point))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2831 ; (progn (re-search-forward paragraph-start nil t 2)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2832 ; (match-beginning 0)))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2833 ; (t nil))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2834
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2835 ;;;
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2836 ;;; ---------- Lint and Browsing ----------
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2837 ;;;
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2838 (defun yahtml-browse-menu ()
138
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
2839 "Browsing or other external process invokation menu."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2840 (interactive)
138
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
2841 (message "J)weblint p)Browse R)eload N)ewpage...")
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2842 (let ((c (char-to-string (read-char))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2843 (cond
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2844 ((string-match "j" c)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2845 (yahtml-lint-buffer (current-buffer)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2846 ((string-match "[bp]" c)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2847 (yahtml-browse-current-file))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2848 ((string-match "r" c)
138
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
2849 (yahtml-browse-reload))
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
2850 ((string-match "n" c)
b7b54906ac3b add newpage.rb
yuuji@gentei.org
parents: 137
diff changeset
2851 (call-interactively 'yahtml-newpage)))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2852
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2853 (if (fboundp 'wrap-function-to-control-ime)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2854 (wrap-function-to-control-ime 'yahtml-browse-menu t nil))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2855
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2856 (defvar yahtml-lint-buffer "*weblint*")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2857
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2858 (defun yahtml-lint-buffer (buf)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2859 "Call lint on buffer BUF."
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2860 (require 'yatexprc)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2861 (interactive "bCall lint on buffer: ")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2862 (setq buf (get-buffer buf))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2863 (YaTeX-save-buffers)
145
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2864 (let ((bcmd (YaTeX-get-builtin "lint")))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2865 (and bcmd (setq bcmd (yahtml-untranslate-string bcmd)))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2866 (YaTeX-typeset
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2867 (concat (or bcmd yahtml-lint-program)
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2868 " " (file-name-nondirectory (buffer-file-name buf)))
efc3819f749b Recognize <!-- #lint CommandLine --> as yahtml-lint-program.
yuuji@gentei.org
parents: 138
diff changeset
2869 yahtml-lint-buffer "lint" "lint")))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2870
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2871 (defun yahtml-file-to-url (file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2872 "Convert local unix file name to URL.
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2873 If no matches found in yahtml-path-url-alist, return raw file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2874 (let ((list yahtml-path-url-alist) p url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2875 (if (file-directory-p file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2876 (setq file (expand-file-name yahtml-directory-index file))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2877 (setq file (expand-file-name file)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2878 (if (string-match "^[A-Za-z]:/" file)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2879 (progn
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2880 ;; (aset file 1 ?|) ;これは要らないらしい…
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2881 (setq file (concat "///" file))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2882 (while list
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2883 (if (string-match (concat "^" (regexp-quote (car (car list)))) file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2884 (setq url (cdr (car list))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2885 file (substring file (match-end 0))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2886 url (concat url file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2887 list nil))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2888 (setq list (cdr list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2889 (or url (concat "file:" file))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2890
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2891 (defun yahtml-url-to-path (file &optional basedir)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2892 "Convert local URL name to unix file name."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2893 (let ((list yahtml-path-url-alist) url realpath docroot
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2894 (dirsufp (string-match "/$" file)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2895 (setq basedir (or basedir
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2896 (file-name-directory
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2897 (expand-file-name default-directory))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2898 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2899 ((string-match "^/" file)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2900 (while list
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
2901 (if (file-directory-p (car (car list)))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2902 (progn
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2903 (setq url (cdr (car list)))
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
2904 (if (string-match "\\(https?://[^/]*\\)/" url)
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2905 (setq docroot (substring url (match-end 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2906 (setq docroot url))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2907 (cond
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2908 ((string-match (concat "^" (regexp-quote docroot)) file)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2909 (setq realpath
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2910 (expand-file-name
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2911 (substring
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2912 file
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2913 (if (= (aref file (1- (match-end 0))) ?/)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2914 (match-end 0) ; "/foo"
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2915 (min (1+ (match-end 0)) (length file)))) ; "/~foo"
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2916 (car (car list))))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2917 (if realpath
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2918 (progn (setq list nil)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2919 (if (and dirsufp (not (string-match "/$" realpath)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2920 (setq realpath (concat realpath "/")))))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2921 (setq list (cdr list)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2922 realpath)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2923 (t file))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2924
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2925 (defun yahtml-browse-current-file ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2926 "Call WWW browser on current file."
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2927 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2928 (basic-save-buffer)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2929 (yahtml-browse-html (yahtml-file-to-url (buffer-file-name))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2930
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2931 (defun yahtml-browse-reload ()
115
d461ecc865d4 Default browser changed from Netscape to Firefox.
yuuji@gentei.org
parents: 103
diff changeset
2932 "Send `reload' event to netscape."
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2933 (let ((pb "* WWW Browser *") (cb (current-buffer)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2934 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2935 ((string-match "[Nn]etscape" yahtml-www-browser)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2936 (if (get-buffer pb)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2937 (progn (set-buffer pb) (erase-buffer) (set-buffer cb)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2938 ;;(or (get 'yahtml-netscape-sentinel 'url)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2939 ;; (error "Reload should be called after Browsing."))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2940 (put 'yahtml-netscape-sentinel 'url
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2941 (yahtml-file-to-url (buffer-file-name)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2942 (basic-save-buffer)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2943 (set-process-sentinel
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2944 (setq yahtml-browser-process
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2945 (start-process
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2946 "browser" pb shell-file-name yahtml-shell-command-option ;"-c"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2947 (format "%s -remote 'reload'" yahtml-www-browser)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2948 'yahtml-netscape-sentinel))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2949 (t
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2950 (message "Sorry, RELOAD is supported only for Netscape.")))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2951
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2952 ;;; ---------- Intelligent newline ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2953 (defun yahtml-intelligent-newline (arg)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2954 "Intelligent newline for HTML"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2955 (interactive "P")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2956 (let (env func)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
2957 (end-of-line)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2958 (setq env (downcase (or (yahtml-inner-environment-but "^\\(a\\|p\\)\\b" t)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2959 "html")))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2960 (setq func (intern-soft (concat "yahtml-intelligent-newline-" env)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2961 (newline)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2962 (if (and env func (fboundp func))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2963 ;; if intelligent line function is defined, call that
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2964 (funcall func)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2965 ;; else do the default action
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2966 (if (string-match yahtml-p-prefered-env-regexp env)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2967 (yahtml-insert-p)))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2968
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2969 (defun yahtml-intelligent-newline-ul ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2970 (interactive)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2971 (yahtml-insert-single "li")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2972 (or yahtml-always-/li yahtml-faithful-to-htmllint (insert " "))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2973 (yahtml-indent-line))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2974
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2975 (fset 'yahtml-intelligent-newline-ol 'yahtml-intelligent-newline-ul)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2976
437
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
2977 (defun yahtml-intelligent-newline-datalist ()
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
2978 (interactive)
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
2979 (yahtml-insert-form "option")
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
2980 (save-excursion (yahtml-insert-form "/option")))
27f00e6e0150 yahtml:datalist can complete id in a buffer
HIROSE Yuuji <yuuji@gentei.org>
parents: 435
diff changeset
2981
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2982 (defun yahtml-intelligent-newline-dl ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2983 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2984 (let ((case-fold-search t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2985 (if (save-excursion
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
2986 (re-search-backward "<\\(\\(dt\\)\\|\\(dd\\)\\)[ \t>]"
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2987 (get 'YaTeX-inner-environment 'point) t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2988 (cond
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2989 ((match-beginning 2)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2990 (yahtml-insert-single "dd")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2991 (or yahtml-always-/dd yahtml-faithful-to-htmllint (insert " "))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2992 (setq yahtml-last-single-cmd "dt"))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2993 ((match-beginning 3)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2994 (yahtml-insert-single "dt")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2995 (or yahtml-always-/dt yahtml-faithful-to-htmllint (insert " "))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
2996 (setq yahtml-last-single-cmd "dd")))
121
4f89dd9d83f2 Fix for yahtml-always-/dt.
yuuji@gentei.org
parents: 117
diff changeset
2997 (yahtml-insert-single "dt")
4f89dd9d83f2 Fix for yahtml-always-/dt.
yuuji@gentei.org
parents: 117
diff changeset
2998 (or yahtml-always-/li yahtml-faithful-to-htmllint (insert " "))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
2999 (setq yahtml-last-single-cmd "dd"))
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3000 (yahtml-indent-line)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3001 (and (string-match yahtml-p-prefered-env-regexp "dl")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3002 (string-equal yahtml-last-single-cmd "dt")
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3003 (yahtml-insert-p nil))))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3004
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3005 (defun yahtml-intelligent-newline-select ()
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3006 (interactive)
315
12fe2878bd30 Add <option> to env-table
HIROSE Yuuji <yuuji@gentei.org>
parents: 294
diff changeset
3007 (yahtml-insert-single (if yahtml-prefer-upcases "OPTION" "option"))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3008 (yahtml-indent-line))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3009
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3010 (defun yahtml-intelligent-newline-style ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3011 (interactive)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3012 (if (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3013 (and
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3014 (re-search-backward "<style\\|<!-- " nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3015 (looking-at "<style")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3016 (let (c)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3017 (yahtml-indent-line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3018 (setq c (current-column))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3019 (insert "<!--\n")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3020 (YaTeX-reindent c)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3021 (insert "-->")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3022 (beginning-of-line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3023 (open-line 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3024 (YaTeX-reindent c))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3025
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3026 (defun yahtml-intelligent-newline-head ()
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
3027 (let ((title (read-string-with-history "Document title: "))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3028 (b "<title>") (e "</title>") p)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3029 (yahtml-indent-line)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3030 (insert (format "%s" (if yahtml-prefer-upcases (upcase b) b)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3031 (setq p (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3032 (insert (format "%s%s" title (if yahtml-prefer-upcases (upcase e) e)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3033 (if (string= "" title) (goto-char p))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3034 (setq yahtml-last-begend "body")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3035
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3036 (defun yahtml-intelligent-newline-script ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3037 (let ((p (point)) b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3038 (if (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3039 (and
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3040 (setq b (re-search-backward "<script\\>" nil t))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3041 (re-search-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3042 "\\(javascript\\)\\|\\(tcl\\)\\|\\(vbscript\\)" p t)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3043 (let ((js (match-end 1)) (tcl (match-end 2)) (vb (match-end 3))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3044 c (srcp (re-search-backward "src=" b t)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3045 (goto-char p)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3046 (yahtml-indent-line)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3047 (setq c (current-column))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3048 (if srcp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3049 nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3050 (insert "<!--\n" (cond (js "//") (tcl "#") (vb "'")) " -->")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3051 (beginning-of-line)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3052 (open-line 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3053 (YaTeX-reindent c))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3054
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3055 (defun yahtml-intelligent-newline-table ()
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3056 (let ((cp (point)) (p (point)) tb rb (cols 0) th line (i 0) fmt
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3057 (ptn "\\(<t[dh]\\>\\)\\|<t\\(r\\|head\\|body\\)\\>"))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3058 (cond
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3059 ((save-excursion (setq tb (YaTeX-beginning-of-environment "table")))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3060 (while (and (setq rb (re-search-backward ptn tb t))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3061 (match-beginning 1))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3062 (setq th (looking-at "<th")) ;Remember if first-child is tr or not
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3063 (goto-char (match-end 0))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3064 (skip-chars-forward " \t\n")
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3065 (if (and (search-forward "colspan\\s *=" p t)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3066 (progn
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3067 (skip-chars-forward "\"' \t\n")
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3068 (looking-at "[0-9]+")))
451
2011de73a671 Who owes the incompatibility of string-to-int?
HIROSE Yuuji <yuuji@gentei.org>
parents: 443
diff changeset
3069 (setq cols (+ (YaTeX-str2int (YaTeX-match-string 0)) cols))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3070 (setq cols (1+ cols)))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3071 (goto-char rb)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3072 (setq p (point)))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3073 (if (> cols 0)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3074 (message "%s columns found. %s"
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3075 cols (if YaTeX-japan "新しいtr(N)? 前のtrの複写?(D)?: "
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3076 "New tr?(N) or Duplicate")))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3077 (cond
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3078 ((and (> cols 0)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3079 (memq (read-char) '(?d ?D))) ;Duplication mode
135
5c61fe39f1c4 Suppress insertion of superfluous newline at duplication of previous <tr>.
yuuji@gentei.org
parents: 121
diff changeset
3080 (setq line (YaTeX-buffer-substring (point) (1- cp))))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3081 (t ;empty cells
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3082 (setq line "<tr>" i 0)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3083 (if (> cols 0)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3084 (while (> cols i)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3085 (setq line (concat line (if (and (= i 0) th) "<th></th>"
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3086 "<td></td>"))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3087 th nil i (1+ i)))
394
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
3088 (setq fmt (read-string-with-history
67fa6d791bc9 Workaround for `Same buffer in multiple frames' applied to yahtml
HIROSE Yuuji <yuuji@gentei.org>
parents: 392
diff changeset
3089 "`th' or `td' format: " "th td td"))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3090 (while (string-match "t\\(h\\)\\|td" fmt i)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3091 (setq line (concat line (if (match-beginning 1) "<th></th>"
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3092 "<td></td>"))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3093 i (match-end 0))))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3094 (setq line (concat line "</tr>"))))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3095 (goto-char cp)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3096 (if th
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3097 (message
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3098 "Type `%s' to change td from/to th."
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3099 (key-description (car (where-is-internal 'yahtml-change-*)))))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3100 (if (string< "" line)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3101 (progn
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3102 (insert line)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3103 (goto-char (+ 8 cp))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3104 (yahtml-indent-line)))))))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3105
438
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3106 (defun yahtml-intelligent-newline-audio ()
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3107 (let (b e)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3108 (if (save-excursion
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3109 (goto-char (setq b (get 'YaTeX-inner-environment 'point)))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3110 (forward-list 1)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3111 (setq e (point))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3112 (catch 'src
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3113 (while (re-search-forward "\\s src\\>" e t)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3114 (skip-chars-forward " \t\n")
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3115 (and (looking-at "=") (throw 'src t)))))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3116 ;; if src= attribute found, do nothing
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3117 (setq yahtml-last-begend "p")
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3118 (yahtml-insert-single "source")
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3119 )))
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3120 (fset 'yahtml-intelligent-newline-video 'yahtml-intelligent-newline-audio)
1b9beabd3fd1 Add add-ins for <audio> and <video>
HIROSE Yuuji <yuuji@gentei.org>
parents: 437
diff changeset
3121
466
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
3122 (defun yahtml-intelligent-newline-iframe ()
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
3123 (insert "<p>Your browser does not support iframes.</p>"))
c7b93cfceb1b Support iframe
HIROSE Yuuji <yuuji@gentei.org>
parents: 465
diff changeset
3124
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3125 ;;; ---------- Marking ----------
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3126 (defun yahtml-mark-begend ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3127 "Mark current tag"
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3128 (interactive)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3129 (YaTeX-beginning-of-environment)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3130 (let ((p (point)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3131 (save-excursion
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3132 (skip-chars-backward " \t" (point-beginning-of-line))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3133 (if (bolp) (setq p (point))))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3134 (push-mark p t))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3135 (yahtml-goto-corresponding-begend)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3136 (forward-list 1)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3137 (if (eolp) (forward-char 1)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
3138
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3139 ;;; ---------- complete marks ----------
432
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3140 (defun yahtml-char-entity-ref ()
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3141 "Complete &gt;, &lt;, &amp;, and &quot;."
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3142 (interactive)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3143 (message "1:< 2:> 3:& 4:\" 5:' 6:nbsp")
432
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3144 (let ((c (read-char)) d)
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3145 (setq d (if (or (< c ?0) (> c ?7))
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3146 (string-match (regexp-quote (char-to-string c)) "<>&\"' ")
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3147 (- c ?1)))
432
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3148 (cond
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3149 ((null d) (insert (format "&#x%x;" c)))
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3150 ((and (>= d 0) (<= d 6))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3151 (insert (format "&%s;"
432
79dc66c450df [prefix] a renamed to yahtml-char-entity-ref, which completes more syms
HIROSE Yuuji <yuuji@gentei.org>
parents: 428
diff changeset
3152 (nth d '("lt" "gt" "amp" "quot" "apos" "nbsp"))))))))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3153
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
3154
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3155 ;;; ---------- jump to error line ----------
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3156 (defun yahtml-prev-error ()
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3157 "Jump to previous error seeing lint buffer."
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3158 (interactive)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3159 (or (get-buffer yahtml-lint-buffer)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3160 (error "No lint program ran."))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3161 (YaTeX-showup-buffer yahtml-lint-buffer nil t)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3162 (yahtml-jump-to-error-line t))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3163
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3164 (defun yahtml-jump-to-error-line (&optional sit)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3165 (interactive "P")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3166 (let ((p (point)) (e (point-end-of-line)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3167 (end-of-line)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3168 (if (re-search-backward yahtml-error-line-regexp nil t)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3169 (let ((f (if (string= "" (YaTeX-match-string 1))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3170 YaTeX-current-file-name
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3171 (YaTeX-match-string 1)))
451
2011de73a671 Who owes the incompatibility of string-to-int?
HIROSE Yuuji <yuuji@gentei.org>
parents: 443
diff changeset
3172 (l (YaTeX-str2int (or (YaTeX-match-string 2)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3173 (YaTeX-match-string 3)))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3174 (if sit (sit-for 1))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3175 (forward-line -1)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3176 (YaTeX-showup-buffer (YaTeX-switch-to-buffer f t) nil t)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3177 (goto-line l))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
3178 (message "No line number usage"))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3179
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3180 ;;; ---------- Style Sheet Support ----------
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3181 (defvar yahtml-css-class-alist nil
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3182 "Alist of elements vs. their classes")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3183
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3184 (defun yahtml-css-collect-classes-region (beg end &optional initial)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3185 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3186 (save-restriction
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3187 (narrow-to-region beg end)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3188 (goto-char (point-min))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3189 (let ((alist initial) b e element class a)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3190 (setq b (point))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3191 (while (re-search-forward "\\({\\)\\|\\(@import\\)" nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3192 (if (match-beginning 2)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3193 (let ((f (YaTeX-buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3194 (progn (skip-chars-forward "^\"")(1+ (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3195 (progn (forward-char 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3196 (skip-chars-forward "^\"")(point)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3197 (if (file-exists-p f)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3198 (setq alist
286
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
3199 (append alist (yahtml-css-collect-classes-file
bf201e406e3f First line header changed.
HIROSE Yuuji <yuuji@gentei.org>
parents: 271
diff changeset
3200 f initial)))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3201 (setq e (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3202 (goto-char b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3203 (while (re-search-forward ;ちょといい加減なREGEXP
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3204 "\\([a-z*][-a-z0-9]*\\)?\\.\\([-a-z0-9][-a-z0-9]*\\)\\>"
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3205 e t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3206 (setq element (YaTeX-match-string 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3207 class (YaTeX-match-string 2))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3208 ;;if starts with period (match-string 1 is nil),
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3209 ;;this is global class
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3210 (setq element (downcase (or element "*")))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3211 (if (setq a (assoc element alist))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3212 (or (assoc class (cdr a))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3213 (setcdr a (cons (list class) (cdr a))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3214 (setq alist (cons (list element (list class)) alist))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3215 (goto-char (1- e))
199
76fe4e01931d Avoid infinte loop on corrupt CSS file.
yuuji@gentei.org
parents: 195
diff changeset
3216 (search-forward "}" nil 1) ;1=move to limit when not found.
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3217 (setq b (point))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3218 alist))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3219
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3220 (defun yahtml-css-collect-classes-buffer (&optional initial)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3221 (interactive)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3222 (yahtml-css-collect-classes-region (point-min) (point-max) initial))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3223
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3224 (defun yahtml-css-collect-classes-file (file &optional initial)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3225 (let*((hilit-auto-highlight nil)
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3226 (buf (get-buffer-create
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3227 (format " *css-collection*%s" (file-name-nondirectory file))))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3228 (cb (current-buffer)))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3229 (unwind-protect
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3230 (progn
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3231 (set-buffer buf)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3232 (insert-file-contents file)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3233 (cd (or (file-name-directory file) "."))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3234 (yahtml-css-collect-classes-buffer initial))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3235 (if (eq buf cb)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3236 nil
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3237 (kill-buffer buf)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3238 (set-buffer cb)))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3239
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3240 (defun yahtml-css-scan-styles ()
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3241 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3242 (goto-char (point-min))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3243 (set (make-local-variable 'yahtml-css-class-alist) nil)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3244 (let (b tag type e href alist)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3245 (while (re-search-forward "<\\(style\\|link\\)" nil t)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3246 (setq b (match-beginning 0)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3247 tag (YaTeX-match-string 1))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3248 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3249 ((string-match "style" tag)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3250 (goto-char b)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3251 (save-excursion (forward-list 1) (setq e (point)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3252 (cond
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3253 ((search-forward "text/css" e 1) ;css definition starts
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3254 (setq alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3255 (yahtml-css-collect-classes-region
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3256 (point) (progn (search-forward "</style>") (point))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3257 alist)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3258 ((and (string-match "link" tag)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3259 (stringp (setq type (yahtml-get-attrvalue "type")))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3260 (string-match "text/css" type)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3261 (setq href (yahtml-get-attrvalue "href"))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3262 (file-exists-p (yahtml-url-to-path href)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3263 (setq alist
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3264 (yahtml-css-collect-classes-file
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3265 (yahtml-url-to-path href) alist))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3266 (setq yahtml-css-class-alist alist)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3267
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3268 (defun yahtml-css-get-element-completion-alist (element)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3269 (let ((alist (cdr-safe (assoc (downcase element) yahtml-css-class-alist)))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
3270 (global (cdr-safe (assoc "*" yahtml-css-class-alist))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3271 (and (or alist global)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3272 (append alist global))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3273
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3274 ;;; ---------- ----------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3275
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3276 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3277 ;;hilit19
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3278 ;;;
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3279 (defvar yahtml-default-face-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3280 '(
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3281 (form black/ivory white/hex-442233 italic)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3282 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3283 (defvar yahtml-hilit-patterns-alist
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3284 '(
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3285 'case-fold
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3286 ;; comments
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3287 ("<!--\\s " "-->" comment)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3288 ;; include&exec
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
3289 ("<!--#\\(include\\|exec\\|config\\|fsize\\|flastmod\\)" "-->" include)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3290 ;; string
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3291 (hilit-string-find ?\\ string)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3292 (yahtml-hilit-region-tag "<\\(strong\\|b\\)\\>" bold)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3293 ("</?[uod]l>" 0 decl)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3294 ("<\\(di\\|dt\\|li\\|dd\\)>" 0 label)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
3295 (yahtml-hilit-region-tag "<\\(em\\|i\\>\\)" italic)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3296 ;("<a\\s +href" "</a>" crossref) ;good for hilit19, but odd for font-lock..
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3297 (yahtml-hilit-region-tag "<\\(a\\)\\s +href" crossref)
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3298 (yahtml-hilit-region-tag-itself "</?\\sw+\\>" decl)
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3299 ))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3300
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3301 (defun yahtml-hilit-region-tag (tag)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3302 "Return list of start/end point of <TAG> form."
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3303 (if (re-search-forward tag nil t)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3304 (let ((m0 (match-beginning 0)) (e0 (match-end 0))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3305 (elm (YaTeX-match-string 1)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3306 (skip-chars-forward "^>")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3307 (prog1
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3308 (cons (1+ (point))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3309 (progn (re-search-forward (concat "</" elm ">") nil t)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3310 (match-beginning 0)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3311 (goto-char e0)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3312
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3313 (defun yahtml-hilit-region-tag-itself (ptn)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3314 "Return list of start/end point of <tag options...> itself."
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3315 (if (re-search-forward ptn nil t)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3316 (let ((m0 (match-beginning 0)) (e0 (match-end 0)))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3317 (skip-chars-forward "^<>")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3318 (if (eq (char-after (point)) ?<) nil
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3319 (prog1
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3320 (cons m0 (min (point-max) (1+ (point))))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3321 (goto-char e0))))))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3322
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 54
diff changeset
3323 ;(setq hilit-patterns-alist (delq (assq 'yahtml-mode hilit-patterns-alist) hilit-patterns-alist))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
3324 (and yahtml-use-hilit19
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3325 (or (assq 'yahtml-mode hilit-patterns-alist)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3326 (setq hilit-patterns-alist
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3327 (cons (cons 'yahtml-mode yahtml-hilit-patterns-alist)
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 61
diff changeset
3328 hilit-patterns-alist))))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3329 ;;;
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3330 ;; for font-lock
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3331 ;;;
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3332
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3333 ; <<STATIC KEYWORDS BELOW NOT USED>>
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3334 ;(defvar yahtml-font-lock-keywords
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3335 ; '(
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3336 ; ;; comments
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3337 ; ("<!--\\s .* -->" . font-lock-comment-face)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3338 ; ;; include&exec
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3339 ; ("<!--#\\(include\\|exec\\|config\\|fsize\\|flastmod\\).*-->"
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3340 ; 0 font-lock-include-face keep)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3341 ; ;; string
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3342 ; ;(hilit-string-find ?\\ string)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3343 ; ;(yahtml-hilit-region-tag "\\(em\\|strong\\)" bold)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3344 ; ("</?[uod]l>" 0 font-lock-keyword-face)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3345 ; ("<\\(di\\|dt\\|li\\|dd\\)>" 0 font-lock-label-face)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3346 ; ("<a\\s +href=.*</a>" (0 font-lock-crossref-face keep))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3347 ; ;(yahtml-hilit-region-tag-itself "</?\\sw+\\>" decl)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3348 ; ("</?\\sw+\\>" (yahtml-fontify-to-tagend nil nil))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3349 ; )
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3350 ; "*Defualt font-lock-keywords for yahtml-mode.")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3351 (defvar yahtml-font-lock-keywords
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3352 (YaTeX-convert-pattern-hilit2fontlock yahtml-hilit-patterns-alist)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3353 "Default fontifying patterns for yahtml-mode")
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3354
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3355 (defun yahtml-font-lock-set-default-keywords ()
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3356 (put 'yahtml-mode 'font-lock-defaults
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3357 '(yahtml-font-lock-keywords nil t)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3358
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3359 (if yahtml-use-font-lock
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3360 (progn
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3361 (if (and (boundp 'hilit-mode-enable-list) hilit-mode-enable-list)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3362 ;;for those who use both hilit19 and font-lock
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3363 (if (eq (car hilit-mode-enable-list) 'not)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3364 (or (member 'yahtml-mode hilit-mode-enable-list)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3365 (nconc hilit-mode-enable-list (list 'yahtml-mode)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3366 (setq hilit-mode-enable-list
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3367 (delq 'yahtml-mode hilit-mode-enable-list))))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3368 (yahtml-font-lock-set-default-keywords)))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
3369
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3370 (defun yahtml-font-lock-recenter (&optional arg)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3371 (interactive "P")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3372 (font-lock-mode -1) ;is stupid, but sure.
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3373 (font-lock-mode 1))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
3374
330
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3375 ;;;
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3376 ;; Drag-n-Drop
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3377 ;;;
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3378 (defun yahtml-dnd-handler (uri action)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3379 "DnD handler for yahtml mode
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3380 Convert image URI to img-src and others to a-href."
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3381 (let*((file (dnd-get-local-file-name uri))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3382 (path (if file (file-relative-name file) uri))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3383 (case-fold-search t)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3384 (geom ""))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3385 (cond
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3386 ((memq action '(copy link move private))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3387 (cond
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3388 ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\)$" path)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3389 (if file
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3390 (setq geom (yahtml-get-image-info path)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3391 geom (if (car geom)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3392 (apply 'format " width=\"%s\" height=\"%s\"" geom)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3393 "")))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3394 (insert (format "<img src=\"%s\" alt=\"%s\"%s>"
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3395 path (file-name-nondirectory path) geom)))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3396
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3397 (t (insert (format "<a href=\"%s\"></a>" path))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3398 (forward-char -4))))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3399 (t (message "No handler for action `%s'" action))))
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3400 action)
9cef5d10a0f1 First Drag-n-Drop support
HIROSE Yuuji <yuuji@gentei.org>
parents: 320
diff changeset
3401
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
3402 (run-hooks 'yahtml-load-hook)
54
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3403 (provide 'yahtml)
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3404
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3405 ; Local variables:
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3406 ; fill-prefix: ";;; "
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3407 ; paragraph-start: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3408 ; paragraph-separate: "^$\\| \\|;;;$"
2d45e43fb35f Full support of English documents
yuuji
parents: 16
diff changeset
3409 ; End:

yatex.org