annotate lisp/psgml/psgml-html.el @ 70:131b0175ea99 r20-0b30

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