annotate lisp/psgml/psgml-html.el @ 24:4103f0995bd7 r19-15b95

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