annotate lisp/psgml/psgml-html.el @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents 8b8b7f3559a2
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; psgml-html.el --- HTML mode in conjunction with PSGML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994 Nelson Minar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Nelson Minar and Ulrik Dickow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
20 ;; along with XEmacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
22 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Synched up with: FSF 19.30.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Author: Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ; Parts were taken from html-helper-mode and from code by Alastair Burt.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
48
56c54cf7c5b6 Import from CVS: tag r19-16b90
cvs
parents: 42
diff changeset
32 ; If you'd like to use the hm--html-minor-mode together with this
56c54cf7c5b6 Import from CVS: tag r19-16b90
cvs
parents: 42
diff changeset
33 ; mode, you have to put the following line to your ~/.emacs:
56c54cf7c5b6 Import from CVS: tag r19-16b90
cvs
parents: 42
diff changeset
34 ; (add-hook 'html-mode-hook 'hm--html-minor-mode)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 16
diff changeset
35
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
38 (defvar html-auto-sgml-entity-conversion nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
39 "*Control automatic sgml entity to ISO-8859-1 conversion")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
40
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (require 'psgml)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (require 'derived)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
43 (when html-auto-sgml-entity-conversion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
44 (require 'iso-sgml))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (require 'tempo) ;essential part of html-helper-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;{{{ user variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; Set this to be whatever signature you want on the bottom of your pages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (defvar html-helper-address-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (concat "<a href=\"mailto:" user-mail-address "\">"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (user-full-name) "</a>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 "*The default author string of each file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (defvar html-helper-htmldtd-version "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 "*Version of HTML DTD you're using.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (defvar html-helper-do-write-file-hooks t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "*If not nil, then modify `local-write-file-hooks' to do timestamps.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (defvar html-helper-build-new-buffer t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "*If not nil, then insert `html-helper-new-buffer-strings' for new buffers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defvar html-helper-timestamp-hook 'html-helper-default-insert-timestamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "*Hook called for timestamp insertion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Override this for your own timestamp styles.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;; strings you might want to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defvar html-helper-new-buffer-template
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 '(html-helper-htmldtd-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "<html>\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 " <head>\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 " <title>" (p "Document Title: " title) "</title>\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 " </head>\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 " <body>\n"
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 24
diff changeset
78 " <h1>" (s title) "</h1>\n\n"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 p
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 24
diff changeset
80 "\n\n <hr>\n"
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 24
diff changeset
81 " <address>" html-helper-address-string "</address>\n"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (html-helper-return-created-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 html-helper-timestamp-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 html-helper-timestamp-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "\n </body>\n</html>\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "*Template for new buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 Inserted by `html-helper-insert-new-buffer-strings' if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 `html-helper-build-new-buffer' is set to t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (defvar html-helper-timestamp-start "<!-- hhmts start -->\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "*Start delimiter for timestamps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 Everything between `html-helper-timestamp-start' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 `html-helper-timestamp-end' will be deleted and replaced with the output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 of the functions `html-helper-timestamp-hook' if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 `html-helper-do-write-file-hooks' is t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defvar html-helper-timestamp-end "<!-- hhmts end -->"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "*End delimiter for timestamps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 Everything between `html-helper-timestamp-start' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 `html-helper-timestamp-end' will be deleted and replaced with the output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 of the function `html-helper-insert-timestamp' if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 `html-helper-do-write-file-hooks' is t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;; control over what types of tags to load. By default, we load all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;; ones we know of.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defvar html-helper-types-to-install
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 '(anchor header logical phys list textel entity image head form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "*List of tag types to install when html-helper-mode is first loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 If you want to not install some type of tag, override this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 Order is significant: menus go in this order.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;}}} end of user variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;{{{ type based keymap and menu variable and function setup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;; html-helper-mode has a concept of "type" of tags. Each type is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; list of tags that all go together in one keymap and one menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; Types can be added to the system after html-helper has been loaded,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; briefly by doing html-helper-add-type-to-alist, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; html-helper-install-type, then html-helper-add-tag (for each tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;; then html-helper-rebuild-menu. See the mode documentation for more detail.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (defconst html-helper-type-alist nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 "Alist: type of tag -> keymap, keybinding, menu, menu string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 Add to this with `html-helper-add-type-to-alist'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;{{{ accessor functions for html-helper-type-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (defun html-helper-keymap-for (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 "Accessor function for alist: for type, return keymap or nil"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (nth 0 (cdr-safe (assq type html-helper-type-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (defun html-helper-key-for (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 "Accessor function for alist: for type, return keybinding or nil"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (nth 1 (cdr-safe (assq type html-helper-type-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (defun html-helper-menu-for (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 "Accessor function for alist: for type, return menu or nil"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (nth 2 (cdr-safe (assq type html-helper-type-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defun html-helper-menu-string-for (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Accessor function for alist: for type, return menustring or nil"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (nth 3 (cdr-safe (assq type html-helper-type-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (defun html-helper-normalized-menu-for (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 "Helper function for building menus from submenus: add on string to menu."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (cons (html-helper-menu-string-for type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (eval (html-helper-menu-for type))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (define-derived-mode html-mode sgml-mode "HTML"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 "Major mode for editing HTML documents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 This is based on PSGML mode, and has a sophisticated SGML parser in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 It knows how to properly indent HTML/SGML documents, and it can do
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 32
diff changeset
156 a form of document validation (use \\[sgml-next-trouble-spot] to find
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 the next error in your document).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 Commands beginning with C-z insert various types of HTML tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (prompting for the required information); to iconify or suspend,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 use C-z C-z.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 To literally insert special characters such as < and &, use C-c followed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 by the character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 Use \\[sgml-insert-end-tag] to insert the proper closing tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 Use \\[sgml-edit-attributes] to edit the attributes for a tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 Use \\[sgml-show-context] to show the current HTML context.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 More specifically:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 \\{html-mode-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (make-local-variable 'sgml-declaration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (make-local-variable 'sgml-default-doctype-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (setq sgml-declaration (expand-file-name "html.decl"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 sgml-data-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 sgml-default-doctype-name "html"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 sgml-always-quote-attributes t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 sgml-indent-step 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 sgml-indent-data t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 sgml-inhibit-indent-tags '("pre")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 sgml-minimize-attributes nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 sgml-omittag t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 sgml-shortag t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; font-lock setup for various emacsen: XEmacs, Emacs 19.29+, Emacs <19.29.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; By Ulrik Dickow <dickow@nbi.dk>. (Last update: 05-Sep-1995).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (cond ((string-match "XEmacs\\|Lucid" (emacs-version)) ; XEmacs/Lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (put major-mode 'font-lock-keywords-case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;; XEmacs (19.13, at least) guesses the rest correctly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; If any older XEmacsen don't, then tell me.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ((string-lessp "19.28.89" emacs-version) ; Emacs 19.29 and later
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (make-local-variable 'font-lock-defaults)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq font-lock-defaults '(html-font-lock-keywords t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (t ; Emacs 19.28 and older
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (make-local-variable 'font-lock-keywords-case-fold-search)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (make-local-variable 'font-lock-keywords)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (make-local-variable 'font-lock-no-comments)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (setq font-lock-keywords-case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (setq font-lock-keywords html-font-lock-keywords)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (setq font-lock-no-comments t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (if html-helper-do-write-file-hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (add-hook 'local-write-file-hooks 'html-helper-update-timestamp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (if (and html-helper-build-new-buffer (zerop (buffer-size)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (html-helper-insert-new-buffer-strings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (set (make-local-variable 'sgml-custom-markup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 '(("<A>" "<A HREF=\"\">\r</a>")))
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
210
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
211 ;; Set up the syntax table.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
212 (modify-syntax-entry ?< "(>" html-mode-syntax-table)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
213 (modify-syntax-entry ?> ")<" html-mode-syntax-table)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
214 (modify-syntax-entry ?\" ". " html-mode-syntax-table)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
215 (modify-syntax-entry ?\\ ". " html-mode-syntax-table)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
216 (modify-syntax-entry ?' "w " html-mode-syntax-table)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 2
diff changeset
217
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ; sigh ... need to call this now to get things working.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (sgml-build-custom-menus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (add-submenu nil sgml-html-menu "SGML")
48
56c54cf7c5b6 Import from CVS: tag r19-16b90
cvs
parents: 42
diff changeset
221 (delete-menu-item '("SGML")))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (defun html-helper-add-type-to-alist (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "Add a type specification to the alist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 The spec goes (type . (keymap-symbol keyprefix menu-symbol menu-string)).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 See code for an example."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (setq html-helper-type-alist (cons type html-helper-type-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; Here are the types provided by html-helper-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (mapcar 'html-helper-add-type-to-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 '((entity . (nil nil html-helper-entity-menu "Insert Character Entities"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (textel . (nil nil html-helper-textel-menu "Insert Text Elements"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (head . (html-helper-head-map "\C-zb" html-helper-head-menu "Insert Structural Elements"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (header . (html-helper-base-map "\C-z" html-helper-header-menu "Insert Headers"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (anchor . (html-helper-base-map "\C-z" html-helper-anchor-menu "Insert Hyperlinks"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (logical . (html-helper-base-map "\C-z" html-helper-logical-menu "Insert Logical Styles"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (phys . (html-helper-base-map "\C-z" html-helper-phys-menu "Insert Physical Styles"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (list . (html-helper-list-map "\C-zl" html-helper-list-menu "Insert List Elements"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (form . (html-helper-form-map "\C-zf" html-helper-form-menu "Insert Form Elements"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (image . (html-helper-image-map "\C-zm" html-helper-image-menu "Insert Inlined Images"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; Once html-helper-mode is aware of a type, it can then install the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; type: arrange for keybindings, menus, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (defconst html-helper-installed-types nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "The types that have been installed (used when building menus).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 There is no support for removing a type once it has been installed.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (defun html-helper-install-type (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 "Install a new tag type: add it to the keymap, menu structures, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 For this to work, the type must first have been added to the list of types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 with html-helper-add-type-to-alist."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (setq html-helper-installed-types (cons type html-helper-installed-types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (let ((keymap (html-helper-keymap-for type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (key (html-helper-key-for type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (menu (html-helper-menu-for type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (menu-string (html-helper-menu-string-for type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (and key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (set keymap nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (define-prefix-command keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (define-key html-mode-map key keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (and menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (set menu nil)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;; install the default types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (mapcar 'html-helper-install-type html-helper-types-to-install)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;;{{{ html-helper-add-tag function for building basic tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defvar html-helper-tempo-tags nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "List of tags used in completion.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;; this while loop is awfully Cish
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;; isn't there an emacs lisp function to do this?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (defun html-helper-string-to-symbol (input-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 "Given a string, downcase it and replace spaces with -.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 We use this to turn menu entries into good symbols for functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 It's not entirely successful, but fortunately emacs lisp is forgiving."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (let* ((s (copy-sequence input-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (l (1- (length s))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (while (> l 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (if (char-equal (aref s l) ?\ )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (aset s l ?\-))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (setq l (1- l)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (concat "html-" (downcase s))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (defun html-helper-add-tag (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 "Add a new tag to html-helper-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 Builds a tempo-template for the tag and puts it into the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 appropriate keymap if a key is requested. Format:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 `(html-helper-add-tag '(type keybinding completion-tag menu-name template doc)'"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (let* ((type (car l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (keymap (html-helper-keymap-for type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (menu (html-helper-menu-for type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (key (nth 1 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (completer (nth 2 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (name (nth 3 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (tag (nth 4 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (doc (nth 5 l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (command (tempo-define-template (html-helper-string-to-symbol name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 tag completer doc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 'html-helper-tempo-tags)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (if (null (memq type html-helper-installed-types)) ;type loaded?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 t ;no, do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (if (stringp key) ;bind key somewhere?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (if keymap ;special keymap?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (define-key (eval keymap) key command) ;t: bind to prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (define-key html-mode-map key command)) ;nil: bind to global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (if menu ;is there a menu?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (set menu ;good, cons it in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (cons (vector name command t) (eval menu))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;;{{{ most of the HTML tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;; These tags are an attempt to be HTML/2.0 compliant, with the exception
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ;; of container <p>, <li>, <dd>, <dt> (we adopt 3.0 behaviour).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; For reference see <URL:http://www.w3.org/hypertext/WWW/MarkUp/MarkUp.html>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 ;; order here is significant: within a tag type, menus and mode help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 ;; go in the reverse order of what you see here. Sorry about that, it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ;; not easy to fix.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 'html-helper-add-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ;;entities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (entity "\C-c#" "&#" "Ascii Code" ("&#" (r "Ascii: ") ";"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (entity "\C-c\"" "&quot;" "Quotation mark" ("&quot;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (entity "\C-c$" "&reg;" "Registered" ("&reg;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (entity "\C-c@" "&copy;" "Copyright" ("&copy;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (entity "\C-c-" "&shy;" "Soft Hyphen" ("&shy;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (entity "\C-c " "&nbsp;" "Nonbreaking Space" ("&nbsp;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (entity "\C-c&" "&amp;" "Ampersand" ("&amp;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (entity "\C-c>" "&gt;" "Greater Than" ("&gt;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (entity "\C-c<" "&lt;" "Less Than" ("&lt;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; logical styles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (logical "q" "<blockquote>" "Blockquote" ("<blockquote>" (r "Quote: ") "</blockquote>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (logical "c" "<code>" "Code" ("<code>" (r "Code: ") "</code>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (logical "x" "<samp>" "Sample" ("<samp>" (r "Sample code") "</samp>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (logical "r" "<cite>" "Citation" ("<cite>" (r "Citation: ") "</cite>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (logical "k" "<kbd>" "Keyboard Input" ("<kbd>" (r "Keyboard: ") "</kbd>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (logical "v" "<var>" "Variable" ("<var>" (r "Variable: ") "</var>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (logical "d" "<dfn>" "Definition" ("<dfn>" (r "Definition: ") "</dfn>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (logical "a" "<address>" "Address" ("<address>" r "</address>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (logical "e" "<em>" "Emphasized" ("<em>" (r "Text: ") "</em>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (logical "s" "<strong>" "Strong" ("<strong>" (r "Text: ") "</strong>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (logical "p" "<pre>" "Preformatted" ("<pre>" (r "Text: ") "</pre>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ;;physical styles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (phys "-" "<strike>" "Strikethru" ("<strike>" (r "Text: ") "</strike>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (phys "u" "<u>" "Underline" ("<u>" (r "Text: ") "</u>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (phys "o" "<i>" "Italic" ("<i>" (r "Text: ") "</i>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (phys "b" "<b>" "Bold" ("<b>" (r "Text: ") "</b>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (phys "t" "<tt>" "Fixed" ("<tt>" (r "Text: ") "</tt>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ;;headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (header "6" "<h6>" "Header 6" ("<h6>" (r "Header: ") "</h6>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (header "5" "<h5>" "Header 5" ("<h5>" (r "Header: ") "</h5>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (header "4" "<h4>" "Header 4" ("<h4>" (r "Header: ") "</h4>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (header "3" "<h3>" "Header 3" ("<h3>" (r "Header: ") "</h3>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (header "2" "<h2>" "Header 2" ("<h2>" (r "Header: ") "</h2>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (header "1" "<h1>" "Header 1" ("<h1>" (r "Header: ") "</h1>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;; forms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (form "o" "<option>" "Option" (& "<option>" > ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (form "v" "<option value" "Option with Value" (& "<option value=\"" (r "Value: ") "\">" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (form "s" "<select" "Selections" ("<select name=\"" (p "Name: ") "\">\n<option>" > "\n</select>")"<select")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (form "z" "<input" "Reset Form" ("<input type=\"RESET\" value=\"" (p "Reset button text: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (form "b" "<input" "Submit Form" ("<input type=\"SUBMIT\" value=\"" (p "Submit button text: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (form "i" "<input" "Image Field" ("<input type=\"IMAGE\" name=\"" (p "Name: ") "\" src=\"" (p "Image URL: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (form "h" "<input" "Hidden Field" ("<input type=\"HIDDEN\" name=\"" (p "Name: ") "\" value=\"" (p "Value: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (form "p" "<textarea" "Text Area" ("<textarea name=\"" (p "Name: ") "\" rows=\"" (p "Rows: ") "\" cols=\"" (p "Columns: ") "\">" r "</textarea>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (form "c" "<input" "Checkbox" ("<input type=\"CHECKBOX\" name=\"" (p "Name: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (form "r" "<input" "Radiobutton" ("<input type=\"RADIO\" name=\"" (p "Name: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (form "t" "<input" "Text Field" ("<input type=\"TEXT\" name=\"" (p "Name: ") "\" size=\"" (p "Size: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (form "f" "<form" "Form" ("<form action=\"" (p "Action: ") "\" method=\"" (p "Method: ") "\">\n</form>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;;lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (list "t" "<dt>" "Definition Item" (& "<dt>" > (p "Term: ") "\n<dd>" > (r "Definition: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (list "l" "<li>" "List Item" (& "<li>" > (r "Item: ")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (list "r" "<dir>" "DirectoryList" (& "<dir>" > "\n<li>" > (r "Item: ") "\n</dir>" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (list "m" "<menu>" "Menu List" (& "<menu>" > "\n<li>" > (r "Item: ") "\n</menu>" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (list "o" "<ol>" "Ordered List" (& "<ol>" > "\n<li>" > (r "Item: ") "\n</ol>" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (list "d" "<dl>" "Definition List" (& "<dl>" > "\n<dt>" > (p "Term: ") "\n<dd>" > (r "Definition: ") "\n</dl>" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (list "u" "<ul>" "Unordered List" (& "<ul>" > "\n<li>" > (r "Item: ") "\n</ul>" >))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ;;anchors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (anchor "n" "<a name=" "Link Target" ("<a name=\"" (p "Anchor name: ") "\">" (r "Anchor text: ") "</a>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (anchor "h" "<a href=" "Hyperlink" ("<a href=\"" (p "URL: ") "\">" (r "Anchor text: ") "</a>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;;graphics
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (image "a" nil "Aligned Image" ("<img align=\"" (r "Alignment: ") "\" src=\"" (r "Image URL: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (image "i" "<img src=" "Image" ("<img src=\"" (r "Image URL: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (image "e" "<img align=" "Aligned Image With Alt. Text" ("<img align=\"" (r "Alignment: ") "\" src=\"" (r "Image URL: ") "\" alt=\"" (r "Text URL: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (image "t" "<img alt=" "Image With Alternate Text" ("<img alt=\"" (r "Text URL: ") "\" src=\"" (r "Image URL: ") "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;;text elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (textel "\C-c=" nil "Horizontal Line" (& "<hr>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (textel "\C-c\C-m" nil "Line Break" ("<br>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (textel "\e\C-m" nil "Paragraph" ("<p>" (progn (sgml-indent-line) nil) "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;;head elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (head "H" "<head>" "Head" ("<head>\n" "</head>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (head "B" "<body>" "Body" ("<body>\n" "</body>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (head "i" "<isindex>" "Isindex" ("<isindex>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (head "n" "<nextid>" "Nextid" ("<nextid>\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (head "h" "<meta http-equiv=" "HTTP Equivalent" ("<meta http-equiv=\"" (p "Equivalent: ") "\" content=\"" (r "Content: ") "\">\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (head "m" "<meta name=" "Meta Name" ("<meta name=\"" (p "Name: ") "\" content=\"" (r "Content: ") "\">\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (head "l" "<link" "Link" ("<link href=\"" p "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (head "b" "<base" "Base" ("<base href=\"" r "\">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (head "t" "<title>" "Title" ("<title>" (r "Document title: ") "</title>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 ;;{{{ html-helper-smart-insert-item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;; there are two different kinds of items in HTML - those in regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;; lists <li> and those in dictionaries <dt>..<dd>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; This command will insert the appropriate one depending on context.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (defun html-helper-smart-insert-item (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 "Insert a new item, either in a regular list or a dictionary."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (interactive "*P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (re-search-backward "<li>\\|<dt>\\|<ul>\\|<ol>\\|<dd>\\|<menu>\\|<dir>\\|<dl>" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (looking-at "<dt>\\|<dl>\\|<dd>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (tempo-template-html-definition-item arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (tempo-template-html-list-item arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 ;; special keybindings in the prefix maps (not in the list of tags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (and (boundp 'html-helper-base-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (define-key html-helper-base-map "i" 'html-helper-smart-insert-item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (define-key html-mode-map "\C-z\C-z" 'suspend-or-iconify-emacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (define-key html-mode-map "\C-zg" 'html-insert-mailto-reference-from-click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 ;; and, special menu bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (and (boundp 'html-helper-list-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (setq html-helper-list-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (cons '["List Item" html-helper-smart-insert-item t] html-helper-list-menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ;;{{{ patterns for font-lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 ; Old patterns from html-mode.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 ;(defvar html-font-lock-keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ; (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 ; '("\\(<[^>]*>\\)+" . font-lock-comment-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 ; '("[Hh][Rr][Ee][Ff]=\"\\([^\"]*\\)\"" 1 font-lock-string-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ; '("[Ss][Rr][Cc]=\"\\([^\"]*\\)\"" 1 font-lock-string-face t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ; "Patterns to highlight in HTML buffers.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ;; By Ulrik Dickow <dickow@nbi.dk>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;; Originally aimed at Emacs 19.29. Later on disabled syntactic fontification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;; and reordered regexps completely, to be compatible with XEmacs (it doesn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;; understand OVERRIDE=`keep').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;; We make an effort on handling nested tags intelligently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;; font-lock compatibility with XEmacs/Lucid and older Emacsen (<19.29).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (if (string-match "XEmacs\\|Lucid" (emacs-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 ;; XEmacs/Lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; Make needed faces if the user hasn't already done so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;; Respect X resources (`make-face' uses them when they exist).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (let ((change-it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (function (lambda (face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (or (if (fboundp 'facep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (facep face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (memq face (face-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (make-face face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (not (face-differs-from-default-p face))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (if (funcall change-it 'html-helper-bold-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (copy-face 'bold 'html-helper-bold-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (if (funcall change-it 'html-helper-italic-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (copy-face 'italic 'html-helper-italic-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (if (funcall change-it 'html-helper-underline-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (set-face-underline-p 'html-helper-underline-face t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (if (funcall change-it 'font-lock-variable-name-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (set-face-foreground 'font-lock-variable-name-face "salmon"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (if (funcall change-it 'font-lock-reference-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (set-face-foreground 'font-lock-reference-face "violet")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;; Emacs (any version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;; Note that Emacs evaluates the face entries in `font-lock-keywords',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;; while XEmacs doesn't. So XEmacs doesn't use the following *variables*,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;; but instead the faces with the same names as the variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (defvar html-helper-bold-face 'bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 "Face used as bold. Typically `bold'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (defvar html-helper-italic-face 'italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 "Face used as italic. Typically `italic'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (defvar html-helper-underline-face 'underline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 "Face used as underline. Typically `underline'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (if (string-lessp "19.28.89" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 () ; Emacs 19.29 and later
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ;; Emacs 19.28 and older
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ;; Define face variables that don't exist until Emacs 19.29.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (defvar font-lock-variable-name-face 'font-lock-doc-string-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 "Face to use for variable names -- and some HTML keywords.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (defvar font-lock-reference-face 'underline ; Ugly at line breaks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 "Face to use for references -- including HTML hyperlink texts.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (defvar html-font-lock-keywords
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (let (;; Titles and H1's, like function defs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 ;; We allow for HTML 3.0 attributes, like `<h1 align=center>'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 (tword "\\(h1\\|title\\)\\([ \t\n]+[^>]+\\)?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;; Names of tags to boldify.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (bword "\\(b\\|h[2-4]\\|strong\\)\\([ \t\n]+[^>]+\\)?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 ;; Names of tags to italify.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (iword "\\(address\\|cite\\|em\\|i\\|var\\)\\([ \t\n]+[^>]+\\)?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; Regexp to match shortest sequence that surely isn't a bold end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ;; We simplify a bit by extending "</strong>" to "</str.*".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;; Do similarly for non-italic and non-title ends.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (not-bend (concat "\\([^<]\\|<\\([^/]\\|/\\([^bhs]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 "b[^>]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 "h\\([^2-4]\\|[2-4][^>]\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 "s\\([^t]\\|t[^r]\\)\\)\\)\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (not-iend (concat "\\([^<]\\|<\\([^/]\\|/\\([^aceiv]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 "a\\([^d]\\|d[^d]\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 "c\\([^i]\\|i[^t]\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 "e\\([^m]\\|m[^>]\\)\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 "i[^>]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 "v\\([^a]\\|a[^r]\\)\\)\\)\\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (not-tend (concat "\\([^<]\\|<\\([^/]\\|/\\([^ht]\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 "h[^1]\\|t\\([^i]\\|i[^t]\\)\\)\\)\\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (list ; Avoid use of `keep', since XEmacs will treat it the same as `t'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;; First fontify the text of a HREF anchor. It may be overridden later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;; Anchors in headings will be made bold, for instance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 '("<a\\s-+href[^>]*>\\([^>]+\\)</a>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 1 font-lock-reference-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ;; Tag pairs like <b>...</b> etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; Cunning repeated fontification to handle common cases of overlap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;; Bold complex --- possibly with arbitrary other non-bold stuff inside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (list (concat "<" bword ">\\(" not-bend "*\\)</\\1>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 3 'html-helper-bold-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ;; Italic complex --- possibly with arbitrary non-italic kept inside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (list (concat "<" iword ">\\(" not-iend "*\\)</\\1>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 3 'html-helper-italic-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ;; Bold simple --- first fontify bold regions with no tags inside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (list (concat "<" bword ">\\(" "[^<]" "*\\)</\\1>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 3 'html-helper-bold-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;; Any tag, general rule, just after bold/italic stuff.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 '("\\(<[^>]*>\\)" 1 font-lock-type-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;; Titles and level 1 headings (anchors do sometimes appear in h1's)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (list (concat "<" tword ">\\(" not-tend "*\\)</\\1>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 3 'font-lock-function-name-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ;; Underline is rarely used. Only handle it when no tags inside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 '("<u>\\([^<]*\\)</u>" 1 html-helper-underline-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ;; Forms, anchors & images (also fontify strings inside)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 '("\\(<\\(form\\|i\\(mg\\|nput\\)\\)\\>[^>]*>\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 1 font-lock-variable-name-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 '("</a>" 0 font-lock-keyword-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 '("\\(<a\\b[^>]*>\\)" 1 font-lock-keyword-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 '("=[ \t\n]*\\(\"[^\"]+\"\\)" 1 font-lock-string-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ;; Large-scale structure keywords (like "program" in Fortran).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;; "<html>" "</html>" "<body>" "</body>" "<head>" "</head>" "</form>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 '("</?\\(body\\|form\\|h\\(ead\\|tml\\)\\)>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 0 font-lock-variable-name-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ;; HTML special characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 '("&[^;\n]*;" 0 font-lock-string-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 ;; SGML things like <!DOCTYPE ...> with possible <!ENTITY...> inside.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 '("\\(<![a-z]+\\>[^<>]*\\(<[^>]*>[^<>]*\\)*>\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 1 font-lock-comment-face t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; Comments: <!-- ... -->. They traditionally override anything else.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 ;; It's complicated 'cause we won't allow "-->" inside a comment, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 ;; font-lock colours the *longest* possible match of the regexp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 '("\\(<!--\\([^-]\\|-[^-]\\|--[^>]\\)*-->\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 1 font-lock-comment-face t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 "Additional expressions to highlight in HTML mode.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (put 'html-mode 'font-lock-defaults '(html-font-lock-keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (put 'html3-mode 'font-lock-defaults '(html-font-lock-keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;;{{{ patterns for hilit19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ;; Define some useful highlighting patterns for the hilit19 package.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 ;; These will activate only if hilit19 has already been loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 ;; Thanks to <dickow@nbi.dk> for some pattern suggestions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (if (featurep 'hilit19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (hilit-set-mode-patterns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 'html-helper-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 '(("<!--" "-->" comment)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ("<![a-z]+\\>[^<>]*\\(<[^>]*>[^<>]*\\)*>" nil comment) ;<!DOCTYPE ...>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ("<title>" "</title>" defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ("<h[1-6]>" "</h[1-6]>" bold) ;only colour inside tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ("<a\\b" ">" define)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ("</a>" nil define)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ("<img\\b" ">" include)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ("<option\\|</?select\\|<input\\|</?form\\|</?textarea" ">" include)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;; First <i> highlighting just handles unnested tags, then do nesting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ("<i>[^<]*</i>" nil italic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ("<b>" "</b>" bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ("<i>" "</i>" italic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 ("<u>" "</u>" underline)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ("&[^;\n]*;" nil string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ("<" ">" keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 nil 'case-insensitive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;;{{{ timestamps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (defun html-helper-update-timestamp ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 "Basic function for updating timestamps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 It finds the timestamp in the buffer by looking for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 `html-helper-timestamp-start', deletes all text up to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 `html-helper-timestamp-end', and runs `html-helper-timestamp-hook' which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 will should insert an appropriate timestamp in the buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (if (not (search-backward html-helper-timestamp-start nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (message "timestamp delimiter start was not found")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (let ((ts-start (+ (point) (length html-helper-timestamp-start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (ts-end (if (search-forward html-helper-timestamp-end nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (- (point) (length html-helper-timestamp-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (if (not ts-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (message "timestamp delimiter end was not found. Type C-c C-t to insert one.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (delete-region ts-start ts-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (goto-char ts-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (run-hooks 'html-helper-timestamp-hook)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (defun html-helper-return-created-string ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 "Return a \"Created:\" string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (let ((time (current-time-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (concat "<!-- Created: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (substring time 0 20)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (nth 1 (current-time-zone))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (substring time -4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 " -->\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (defun html-helper-default-insert-timestamp ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 "Default timestamp insertion function."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (let ((time (current-time-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (insert "Last modified: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (substring time 0 20)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (nth 1 (current-time-zone))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 " "
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
660 (substring time -4)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 "\n")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (defun html-helper-insert-timestamp-delimiter-at-point ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 "Simple function that inserts timestamp delimiters at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 Useful for adding timestamps to existing buffers."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (insert html-helper-timestamp-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (insert html-helper-timestamp-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 (defun mail-address-at-point (pos &optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 "Return a list (NAME ADDRESS) of the address at POS in BUFFER."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (or buffer (setq buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 (let (beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 (set-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 (goto-char pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 (or (re-search-forward "[\n,]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 (error "Can't find address at position"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 (backward-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 (or (re-search-backward "[\n,:]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 (error "Can't find address at position"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 (forward-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 (re-search-forward "[ \t]*" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 (setq beg (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 (mail-extract-address-components (buffer-substring beg end))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 (defun html-insert-mailto-reference-from-click ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 "Insert a mailto: reference for the clicked-on e-mail address."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 (let (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 (message "Click on a mail address:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 (setq event (next-command-event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 (or (mouse-event-p event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 (error "Aborted.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 (let ((lis (mail-address-at-point (event-closest-point event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 (event-buffer event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 (insert "<a href=\"mailto:" (car (cdr lis)) "\">"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (or (car lis) (car (cdr lis))) "</a>"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (defun html-quote-region (begin end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 "\"Quote\" any characters in the region that have special HTML meanings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 This converts <'s, >'s, and &'s into the HTML commands necessary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 get those characters to appear literally in the output."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (goto-char begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (while (search-forward "&" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (insert "&amp;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (goto-char begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (while (search-forward "<" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (insert "&lt;"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (goto-char begin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (while (search-forward ">" end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (forward-char -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (delete-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (insert "&gt;"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 ;;{{{ html-helper-insert-new-buffer-strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (tempo-define-template "html-skeleton" html-helper-new-buffer-template
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 "Insert a skeleton for a HTML document")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 (defun html-helper-insert-new-buffer-strings ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 "Insert `html-helper-new-buffer-strings'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (tempo-template-html-skeleton))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 ;;}}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 (autoload 'html-mode "psgml-html" "HTML mode." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (autoload 'html3-mode "psgml-html" "HTML3 mode." t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (defvar sgml-html-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (cons "HTML"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (append '(["View in Netscape" sgml-html-netscape-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (current-buffer))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 ["View in W3" w3-preview-this-buffer t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 "---"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 ["HTML-Quote Region" html-quote-region t]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 "---")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
754 (cdr sgml-main-menu))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 (defun sgml-html-netscape-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 "Preview the file for the current buffer in Netscape."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 (highlight-headers-follow-url-netscape
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (concat "file:" (buffer-file-name (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 (define-derived-mode html3-mode html-mode "HTML3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (setq sgml-declaration (expand-file-name "html3.decl"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 sgml-data-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 sgml-default-doctype-name "html-3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 sgml-shortag nil ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767