annotate lisp/w3/w3-parse.el @ 173:8eaf7971accc r20-3b13

Import from CVS: tag r20-3b13
author cvs
date Mon, 13 Aug 2007 09:49:09 +0200
parents 5a88923fcbfe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1 ;; Created by: Joe Wells, jbw@cs.bu.edu
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Created on: Sat Sep 30 17:25:40 1995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Filename: w3-parse.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Purpose: Parse HTML and/or SGML for Emacs W3 browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
6 ;; Copyright © 1995, 1996, 1997 Joseph Brian Wells
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
7 ;; Copyright © 1993, 1994, 1995 by William M. Perry (wmperry@cs.indiana.edu)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; it 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 of the License, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; (at your option) 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 ;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; but 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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; GNU 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
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
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 ;; On November 13, 1995, the license was available at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; <URL:ftp://prep.ai.mit.edu/pub/gnu/COPYING-2.0>. It may still be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; obtainable via that URL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Trying to make the best of an evil speed hack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; Explanation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; Basically, this file provides one big function (w3-parse-buffer) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; some data structures. However, to avoid code redundancy, I have broken
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; out some common subexpressions of w3-parse-buffer into separate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; functions. I have declared these separate functions with "defsubst" so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; they will be inlined into w3-parse-buffer. Also, I have defined them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; within eval-when-compile forms, so no definitions will be emitted into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; the .elc file for these separate functions. (They will work normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; when the uncompiled file is loaded.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; Each of these subfunctions use some scratch variables in a purely local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; fashion. In good software design, I would declare these variables as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; close to their use as possible with "let". However, "let"-binding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; variables is *SLOW* in Emacs Lisp, even when compiled. Since each of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; these functions is executed one or more time during each iteration of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; the main loop, I deemed this too expensive. So the main function does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; the "let"-binding of these variables. However, I still want to declare
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; them close to their use, partially to keep the compiler from crying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; "Wolf!" when there is no danger (well, maybe a little danger :-), so I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; define some macros for this purpose.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; Also, there are some variables which are updated throughout the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; (remember this is really all one function). Some of the code which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; updates them is located inside the subfunctions. So that the compiler
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; will not complain, these variables are defined with defvar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (require 'w3-vars)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
61 (require 'mule-sysdp)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (defconst w3-p-s-var-list nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "A list of the scratch variables used by functions called by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 w3-parse-buffer which it is w3-parse-buffer's responsibility to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 \"let\"-bind.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (defmacro w3-p-s-var-def (var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "Declare VAR as a scratch variable which w3-parse-buffer must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 \"let\"-bind."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (` (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defvar (, var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (or (memq '(, var) w3-p-s-var-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (setq w3-p-s-var-list (cons '(, var) w3-p-s-var-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (defmacro w3-p-s-let-bindings (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "\"let\"-bind all of the variables in w3-p-s-var-list in BODY."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (` (let (, w3-p-s-var-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (,@ body))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (put 'w3-p-s-let-bindings 'lisp-indent-function 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (put 'w3-p-s-let-bindings 'edebug-form-spec t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defvar w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (put 'w3-p-d-current-element 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "Information structure for the current open element.")
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 w3-p-d-exceptions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (put 'w3-p-d-exceptions 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 "Alist specifying elements (dis)allowed because of an (ex|in)clusion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 exception of some containing element (not necessarily the immediately
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 containing element). Each item specifies a transition for an element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 which overrides that specified by the current element's content model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 Each item is of the form (TAG ACTION *same ERRORP).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defvar w3-p-d-in-parsed-marked-section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (put 'w3-p-d-in-parsed-marked-section 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "Are we in a parsed marked section so that we have to scan for \"]]>\"?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defvar w3-p-d-non-markup-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (put 'w3-p-d-non-markup-chars 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "The characters that do not indicate the start of markup, in the format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 for an argument to skip-chars-forward.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defvar w3-p-d-null-end-tag-enabled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (put 'w3-p-d-null-end-tag-enabled 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 "Is the null end tag (\"/\") enabled?")
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 w3-p-d-open-element-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (put 'w3-p-d-open-element-stack 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 "A stack of the currently open elements, with the innermost enclosing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 element on top and the outermost on bottom.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (defvar w3-p-d-shortrefs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (put 'w3-p-d-shortrefs 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "An alist of the magic entity reference strings in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 between-tags region and their replacements. Each item is of the format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 \(REGEXP . REPLACEMENT-STRING\). Although in SGML shortrefs normally name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 entities whose value should be used as the replacement, we have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 preexpanded the entities for speed. We have also regexp-quoted the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 strings to be replaced, so they can be used with looking-at. This should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 never be in an element's overrides field unless
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 w3-p-d-shortref-chars is also in the field.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (defvar w3-p-d-shortref-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (put 'w3-p-d-shortref-chars 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 "A string of the characters which can start shortrefs in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 between-tags region. This must be in a form which can be passed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 skip-chars-forward and must contain exactly the characters which start the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 entries in w3-p-d-shortrefs. If this variable is mentioned in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 overrides field of an element, its handling is magical in that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 variable w3-p-d-non-markup-chars is saved to the element's undo-list and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 updated at the same time. This should never be in an element's overrides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 field unless w3-p-d-shortrefs is also in the field.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (defvar w3-p-d-tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (put 'w3-p-d-tag-name 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 "Name of tag we are looking at, as an Emacs Lisp symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 Only non-nil when we are looking at a tag.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (defvar w3-p-d-end-tag-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (put 'w3-p-d-end-tag-p 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 "Is the tag we are looking at an end tag?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 Only non-nil when we are looking at a tag.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;; HTML syntax error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (defvar w3-p-d-debug-url)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (put 'w3-p-d-debug-url 'variable-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 "Whether to print the URL being parsed before an error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 Only true for the first error message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; The level parameter indicates whether the error is (1) very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; serious, must be displayed to all users, (2) invalid HTML, but the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; user should only be told if the user has indicated interest, or (3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; valid HTML which is bad because it appears to rely on the way certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; browsers will display it, which should only be displayed to the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; if they have really asked for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defmacro w3-debug-html (&rest body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "Emit a warning message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 These keywords may be used at the beginning of the arguments:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 :mandatory-if sexp -- force printing if sexp evaluates non-nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 :bad-style -- do not print unless w3-debug-html is 'style.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 :outer -- do not include the current element in the element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 context we report.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 :nocontext -- do not include context where error detected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 The remaining parameters are treated as the body of a progn, the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 which must be a string to use as the error message."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let (mandatory-if bad-style outer nocontext condition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (while (memq (car body) '(:mandatory-if :bad-style :outer :nocontext))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (cond ((eq ':mandatory-if (car body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (setq mandatory-if (car (cdr body)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (setq body (cdr (cdr body))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ((eq ':bad-style (car body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (setq bad-style t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq body (cdr body)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ((eq ':nocontext (car body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (setq nocontext t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq body (cdr body)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ((eq ':outer (car body))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (setq outer t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (setq body (cdr body)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (setq condition (if bad-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 '(eq 'style w3-debug-html)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 'w3-debug-html))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (if mandatory-if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (setq condition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (` (or (, mandatory-if)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (, condition)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (` (if (, condition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (let ((message (progn (,@ body))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (if message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (w3-debug-html-aux message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (,@ (if nocontext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (list outer nocontext)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (if outer '(t)))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; This is unsatisfactory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (put 'w3-debug-html 'lisp-indent-function 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (put 'w3-debug-html 'edebug-form-spec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 '([&rest &or ":nocontext" ":outer" [":mandatory-if" form] ":bad-style"]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 &rest form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (defun w3-debug-html-aux (message &optional outer nocontext)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
215 (push (if nocontext
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
216 message
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
217 (concat message
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
218 ;; Display context information for each error
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
219 ;; message.
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
220 "\n Containing elements: "
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
221 (w3-open-elements-string (if outer 1))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
222 (concat
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
223 "\n Text around error: "
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
224 (save-restriction
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
225 (widen)
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
226 (progn
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
227 (insert "*ERROR*")
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
228 (prog1
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
229 (w3-quote-for-string
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
230 (buffer-substring
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
231 (max (- (point) 27) (point-min))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
232 (min (+ (point) 20) (point-max))))
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 165
diff changeset
233 (delete-char -7))))))) w3-current-badhtml))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defun w3-quote-for-string (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (set-buffer (get-buffer-create " w3-quote-whitespace"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (insert string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (insert "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (skip-chars-forward "^\"\\\t\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (not (eobp)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
245 (insert "\\" (cdr (assq (char-after (point)) '((?\" . "\"")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
246 (?\\ . "\\")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
247 (?\t . "t")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
248 (?\n . "n")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
249 (?\r . "r")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (delete-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (insert "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (buffer-string)))
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 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ;;; General entity references and numeric character references.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; *** MULE conversion?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;; *** I18N HTML support?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (let ((html-entities w3-html-entities))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (while html-entities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (put (car (car html-entities)) 'html-entity-expansion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (cons 'CDATA (if (integerp (cdr (car html-entities)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
266 (char-to-string
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
267 (mule-make-iso-character (cdr (car html-entities))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (cdr (car html-entities)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (setq html-entities (cdr html-entities))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; These are handled differently than the normal HTML entities because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;; we need to define the entities with 'nil instead of 'CDATA so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 ;; that they are correctly scanned for new markup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;; from jbw@cs.bu.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;;> Of course, this differs from the specification a bit. The W3C tech
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;;> report defines all of these as SYSTEM entities. This potentially means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;;> that they can be used in more contexts. The method I outlined above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;;> means "&smiley;" can only be used in contexts where IMG is a valid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;;> element. I am not sure exactly where it is okay to use a SYSTEM entity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;;> I think anywhere that data characters are accepted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;; I find this acceptable, as just what the hell are you supposed to do with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;; &computer; as part of a value of a form input when you display it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; submit it?!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (let ((html-entities w3-graphic-entities)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (cur nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (while html-entities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (setq cur (car html-entities)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 html-entities (cdr html-entities))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (put (nth 0 cur) 'html-entity-expansion
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
294 (cons 'nil (format "<img src=\"%s/%s%s\" alt=\"%s\">"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 w3-icon-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (nth 1 cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (if w3-icon-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (concat "." (symbol-name w3-icon-format))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (or (nth 3 cur) (nth 2 cur)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;; These are the general entities in HTML 3.0 in terms of which the math
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; shortrefs are defined:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 ;; <!ENTITY REF1 STARTTAG "SUP">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;; <!ENTITY REF2 ENDTAG "SUP">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; <!ENTITY REF3 STARTTAG "SUB">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; <!ENTITY REF4 ENDTAG "SUB">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; <!ENTITY REF5 STARTTAG "BOX">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; <!ENTITY REF6 ENDTAG "BOX">
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; We're ignoring them because these names should really be local to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; DTD and not visible in the document. They might change at any time in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ;; future HTML standards.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 ;; <!--Entities for language-dependent presentation (BIDI and contextual analysis) -->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;; <!ENTITY zwnj CDATA "&#8204;"-- zero width non-joiner-->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ;; <!ENTITY zwj CDATA "&#8205;"-- zero width joiner-->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 ;; <!ENTITY lrm CDATA "&#8206;"-- left-to-right mark-->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 ;; <!ENTITY rlm CDATA "&#8207;"-- right-to-left mark-->
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ;; Entity names are case sensitive!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;; & should only be recognized when followed by letter or # and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;; digit or # and letter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (w3-p-s-var-def w3-p-s-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (w3-p-s-var-def w3-p-s-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (w3-p-s-var-def w3-p-s-num)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 ;; Destroys free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ;; w3-p-s-entity, w3-p-s-pos, w3-p-s-num
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 ;; Depends on case-fold-search being t.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (defsubst w3-expand-entity-at-point-maybe ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ;; We are looking at a &.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ;; Only &A or &#1 or &#A syntax is special.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 ((and (looking-at "&\\([a-z][-a-z0-9.]*\\)[\ ;\n]?") ; \n should be \r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 ;; We are looking at a general entity reference, maybe undefined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (setq w3-p-s-entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (intern (buffer-substring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 'html-entity-expansion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 ;; If the reference was undefined, then for SGML, we should really
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; issue a warning and delete the reference. However, the HTML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; standard (contradicting the SGML standard) says to leave the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; undefined reference in the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; We are looking at a defined general entity reference.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (replace-match "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (cond ((eq 'CDATA (car w3-p-s-entity))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 ;; Leave point after expansion so we don't rescan it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (insert (cdr w3-p-s-entity)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ((memq (car w3-p-s-entity) '(nil STARTTAG ENDTAG MS MD))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ;; nil is how I mark ordinary entities.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ;; The replacement text gets rescanned for all of these.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (setq w3-p-s-pos (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (insert (cdr (assq (car w3-p-s-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 '((nil . "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (STARTTAG . "<")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (ENDTAG . "</")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (MS . "<![")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (MD . "<!"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (cdr w3-p-s-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (cdr (assq (car w3-p-s-entity)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 '((nil . "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (STARTTAG . ">")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (ENDTAG . ">")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (MS . "]]>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (MD . ">")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (goto-char w3-p-s-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;; *** Strictly speaking, if we parse anything from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 ;; replacement text, it must end before the end of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;; replacement text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ((eq 'SDATA (car w3-p-s-entity))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (insert "[Unimplemented SDATA \"%s\"]" (cdr w3-p-s-entity)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ((eq 'PI (car w3-p-s-entity))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;; We are currently ignoring processing instructions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;; *** Strictly speaking, we should issue a warning if this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;; occurs in a attribute value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;; *** We don't handle external entities yet.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (error "[Unimplemented entity: \"%s\"]" w3-p-s-entity))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ((looking-at "&#[0-9][0-9]*\\([\ ;\n]?\\)") ; \n should be \r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;; We are looking at a numeric character reference.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; Ensure the number is already terminated by a semicolon or carriage
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; return so we can use "read" to get it as a number quickly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (cond ((= (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; This is very uncommon, so we don't have to be quick here but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; rather correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (goto-char (match-end 0)) ; same as match-end 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (insert ?\;))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;; Set up the match data properly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (looking-at "&#[0-9][0-9]*;")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (forward-char 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (setq w3-p-s-num (read (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 ;; Always leave point after the expansion of a numeric
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; character reference, like it were a CDATA entity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (replace-match "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;; char-to-string will hopefully do something useful with characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;; larger than 255. I think in MULE it does. Is this true?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;; Bill wants to call w3-resolve-numeric-entity here, but I think
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;; that functionality belongs in char-to-string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;; The largest valid character in the I18N version of HTML is 65533.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
411 ;; ftp://ds.internic.net/internet-drafts/draft-ietf-html-i18n-01.txt
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
412 ;; wrongo! Apparently, mule doesn't do sane things with char-to-string
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
413 ;; -wmp 7/9/96
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
414 (insert (char-to-string
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
415 (mule-make-iso-character w3-p-s-num))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ((looking-at "&#\\(re\\|rs\\|space\\|tab\\)[\ ;\n]?") ; \n should be \r
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (replace-match (assq (upcase (char-after (+ 3 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 '(;; *** Strictly speaking, record end should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ;; carriage return.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (?E . "\n") ; RE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;; *** And record start should be line feed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (?S . "") ; RS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (?P . " ") ; SPACE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (?A . "\t")))) ; TAB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;; Leave point after the expansion of a character reference, so it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 ;; doesn't get rescanned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;; *** Strictly speaking, we should issue a warning for &#foo; if foo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;; is not a function character in the SGML declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
431 ((eq ?& (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ;; We are either looking at an undefined reference or a & that does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 ;; not start a reference (in which case we should not have been called).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ;; Skip over the &.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 ;; What is the code doing calling us if we're not looking at a "&"?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (error "this should never happen"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 ;;; Syntax table used in markup declarations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (defvar w3-sgml-md-syntax-table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (let ((table (make-syntax-table))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (items '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (0 "." 255) ; clear everything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (?\r " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (?\t " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (?\n " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (32 " ") ; space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (?< "\(>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (?> "\)<")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (?\( "\(\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (?\) "\)\(")
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 (?\" "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (?\' "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (?a "w" ?z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (?A "w" ?Z)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (?0 "w" ?9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (?. "w")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;; "-" can be a character in a NAME, but it is also used in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;; "--" as both a comment start and end within SGML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;; declarations ("<!" ... ">"). In HTML, it is only used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;; as a NAME character in the parameter entities
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;; Content-Type, HTTP-Method, and style-notations and in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ;; the attribute name http-equiv and in the notation names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;; dsssl-lite and w3c-style. We would like to be able to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;; train Emacs to skip over these kinds of comments with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;; forward-sexp and backward-sexp. Is there any way to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 ;; teach Emacs how to do this? It doesn't seem to be the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (?- "w")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (while items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (let* ((item (car items))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (char (car item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (syntax (car (cdr item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (bound (or (car-safe (cdr-safe (cdr item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 char)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (while (<= char bound)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (modify-syntax-entry char syntax table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (setq char (1+ char))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (setq items (cdr items)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 "A syntax table for parsing SGML markup declarations.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ;;; Element information data type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;; The element information data type is used in two ways:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;; * To store the DTD, there is one element record for each element in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ;; the DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 ;; * To store information for open elements in the current parse tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;; Each such element is initialized by copying the element record
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;; from the DTD. This means that values in the fields can not be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ;; destructively altered, although of course the fields can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ;; changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 ;; The cells in this vector are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ;; name: the element's name (a generic identifier).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ;; end-tag-name: a symbol whose name should be the result of prefixing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 ;; the generic-identifier with a slash. This is a convenience value for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 ;; interfacing with the display engine which expects a stream of start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ;; and end tags in this format rather than a tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 ;; content-model: a data structure describing what elements or character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 ;; data we expect to find within this element. This is either a symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;; listed here:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ;; EMPTY: no content, no end-tag allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 ;; CDATA: all data characters until "</[a-z]" is seen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ;; XCDATA: special non-SGML-standard mode which includes all data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;; characters until "</foo" is seen where "foo" is the name of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 ;; element. (for XMP and LISTING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;; XXCDATA: special non-SGML-standard mode which includes all data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ;; until end-of-entity (end-of-buffer for us). (for PLAINTEXT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;; RCDATA: all data characters until "</[a-z]" is seen, except that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;; entities are expanded first, although the expansions are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;; scanned for end-tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; XINHERIT: special non-SGML-standard mode which means to use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ;; content model of the containing element instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 ;; or a vector of this structure:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ;; [(INCLUDES INCSPACEP (((TAG ...) . TRANSITION) ...) DEFAULT) ...]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 ;; where INCLUDES is of the format:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;; (TAG ...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;; where each TRANSITION is one of these:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ;; (ACTION NEW-STATE ERRORP)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; (ACTION NEW-STATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;; (ACTION)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ;; where DEFAULT is one of these:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 ;; nil or TRANSITION
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 ;; where the meaning of the components is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 ;; INCLUDES is a list of tags for which the transition (*include *same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;; nil) applies.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;; DEFAULT if non-nil is a transition that should be taken when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;; matching any possibility not explicitly listed in another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ;; TRANSITION, except for data characters containing only whitespace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 ;; INCSPACEP specifies how to handle data characters which include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ;; only whitespace characters. The value is non-nil to indicate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ;; (*include *same nil) or nil to indicate (*discard *same nil).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ;; TAG is a symbol corresponding to the start-tag we are looking at,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ;; or *data when seeing character data that includes at least one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ;; non-space character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;; ACTION is one of:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;; *close: Close this element and try again using content model of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;; enclosing element. (Note that this does not apply to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ;; case of an element being closed by its own end-tag.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 ;; *include: Process new element as subelement of this one or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 ;; include data characters directly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ;; *discard: Discard a start-tag or data characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 ;; *retry: Try again after processing NEW-STATE and ERRORP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; ELEMENT: Open ELEMENT (with default attributes), then try again
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 ;; using its content model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 ;; NEW-STATE (optional, default *same) is the index of the state to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 ;; move to after processing the element or one of these:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 ;; *same: no state change occurs.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
585 ;; *next: change the current state + 1.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 ;; The initial state is 0. NEW-STATE does not matter if ACTION is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 ;; *close.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 ;; ERRORP (optional, default nil) if non-nil indicates this transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ;; represents an error. The error message includes this value if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 ;; is a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ;; If no matching transition is found, the default transition is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 ;; (*discard *same "not allowed here").
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ;; overrides: An alist of pairs of the form (VAR REPLACEP . VALUE).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 ;; When this element is opened, the old value of VAR is saved in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;; undo-list. If REPLACEP is non-nil, then VAR gets value VALUE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ;; otherwise VAR gets value (append VALUE (symbol-value VAR)). Useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 ;; values for VAR are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ;; w3-p-d-exceptions: See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 ;; w3-p-d-shortrefs: See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 ;; w3-p-d-shortref-chars: See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;; end-tag-omissible: Whether it is legal to omit the end-tag of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ;; element. If an end-tag is inferred for an element whose end tag is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 ;; not omissible, an error message is given.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 ;; state: The current state in the content model. Preset to the initial
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 ;; state of 0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ;; undo-list: an alist of of former values of local variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 ;; of w3-parse-buffer to restore upon closing this element. Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 ;; item on the list is of the format (VAR . VALUE-TO-RESTORE).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 ;; attributes: an alist of attributes and values. Each item on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 ;; this list is of the format (ATTRIBUTE-NAME . VALUE). Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 ;; ATTRIBUTE-NAME is a symbol and each attribute value is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ;; string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;; content: a list of the accumulated content of the element. While the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 ;; element is open, the list is in order from latest to earliest,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 ;; otherwise it is in order from earliest to latest. Each member is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ;; either a string of data characters or a list of the form (NAME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; ATTRIBUTES CONTENT), where NAME is the subelement's name, ATTRIBUTES
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; is an alist of the subelement's attribute names (lowercase symbols)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 ;; and their values (strings), and CONTENT is the subelement's content.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (defconst w3-element-fields
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 '(name end-tag-name content-model state overrides undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 content attributes end-tag-omissible deprecated))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (let* ((fields w3-element-fields)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (index (1- (length fields))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (while fields
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (let* ((field (symbol-name (car fields)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (get-sym (intern (concat "w3-element-" field)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 (set-sym (intern (concat "w3-set-element-" field))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 (eval (` (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (defmacro (, get-sym) (element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 (list 'aref element (, index)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 (defmacro (, set-sym) (element value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (list 'aset element (, index) value))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 (setq fields (cdr fields))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 (setq index (1- index))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (defmacro w3-make-element ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (list 'make-vector (length w3-element-fields) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 ;; *** move this to be with DTD declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 (defmacro w3-fresh-element-for-tag (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (` (copy-sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 (or (get (, tag) 'html-element-info)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (error "unimplemented element %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (w3-sgml-name-to-string (, tag)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 ;; *** move this to be with DTD declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (defmacro w3-known-element-p (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 (` (get (, tag) 'html-element-info)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (defsubst w3-sgml-name-to-string (sym)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (upcase (symbol-name sym)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ;;; Parse tree manipulation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 ;; ;; Find the name of the previous element or a substring of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 ;; ;; preceding data characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 ;; (let ((content (w3-element-content (car stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 ;; (while content
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 ;; (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 ;; ((and (stringp (car content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 ;; (not (string-match "\\`[ \t\n\r]*\\'" (car content))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 ;; (setq prior-item (car content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 ;; ;; Trim trailing whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 ;; (if (string-match "\\(.*[^ \t\n\r]\\)[ \t\n\r]*\\'" prior-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 ;; (setq prior-item (substring prior-item 0 (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 ;; (if (> (length prior-item) 8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 ;; (setq prior-item (concat "..." (substring prior-item -8))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 ;; (setq prior-item (w3-quote-for-string prior-item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 ;; (setq prior-item (concat "\(after " prior-item "\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 ;; (setq content nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 ;; ((and (consp (car content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 ;; (symbolp (car (car content))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 ;; (setq prior-item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 ;; (concat "\(after "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 ;; (w3-sgml-name-to-string (car (car content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 ;; "\)"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 ;; (setq content nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 ;; (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 ;; (setq content (cdr content))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 ;; Only used for HTML debugging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 (defun w3-open-elements-string (&optional skip-count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 (let* ((stack (nthcdr (or skip-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 (cons w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 w3-p-d-open-element-stack)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 ;;(prior-item "(at start)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 ;; Accumulate the names of the enclosing elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 (while stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 (let ((element (w3-element-name (car stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (if (eq '*holder element)
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 ;; Only include *DOCUMENT if there are no other elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (if (or (not (eq '*document element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (null result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (setq result (cons (w3-sgml-name-to-string element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 result)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 (setq stack (cdr stack)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (setq result (mapconcat 'identity result ":"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (if result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 ;;(concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 ;; prior-item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 "[nowhere!]")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 ;; *** This doesn't really belong here, but where?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (defmacro w3-invalid-sgml-chars ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 "Characters not allowed in an SGML document using the reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 concrete syntax (i.e. HTML). Returns a string in the format expected by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 skip-chars-forward."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 "\000-\010\013\014\016-\037\177-\237"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 ;; Uses:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 ;; w3-p-d-null-end-tag-enabled, w3-p-d-in-parsed-marked-section,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 ;; w3-p-d-shortref-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 ;; Modifies free variable:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ;; w3-p-d-non-markup-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 (defsubst w3-update-non-markup-chars ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 (setq w3-p-d-non-markup-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 (concat "^&<"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 (w3-invalid-sgml-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 (if w3-p-d-null-end-tag-enabled "/" "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 (if w3-p-d-in-parsed-marked-section "]" "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 (or w3-p-d-shortref-chars ""))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (w3-p-s-var-def w3-p-s-overrides)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 (w3-p-s-var-def w3-p-s-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (w3-p-s-var-def w3-p-s-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ;; Uses free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 ;; w3-p-d-non-markup-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 ;; Modifies free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 ;; w3-p-d-current-element, w3-p-d-open-element-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 ;; Destroys free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 ;; w3-p-s-overrides, w3-p-s-undo-list, w3-p-s-var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 (defsubst w3-open-element (tag attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 ;; Push new element on stack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 (setq w3-p-d-open-element-stack (cons w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 w3-p-d-open-element-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 (setq w3-p-d-current-element (w3-fresh-element-for-tag tag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 ;; Warn if deprecated or obsolete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 (if (w3-element-deprecated w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 (w3-debug-html :outer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 (format "%s element %s."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 (if (eq 'obsolete
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 (w3-element-deprecated w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 "Obsolete"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 "Deprecated")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 (w3-sgml-name-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 (w3-element-name w3-p-d-current-element)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 ;; Store attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 ;; *** we are not handling #CURRENT attributes (HTML has none).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (w3-set-element-attributes w3-p-d-current-element attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 ;; *** Handle default attribute values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 ;; *** Fix the attribute name for unnamed values. Right now they will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 ;; be in the attribute list as items of the format (VALUE . VALUE) where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 ;; both occurrences of VALUE are the same. The first one needs to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 ;; changed to the proper attribute name by consulting the DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 ;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 ;; Handle syntax/semantics overrides of new current element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (cond ((w3-element-overrides w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (setq w3-p-s-overrides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 (w3-element-overrides w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (setq w3-p-s-undo-list nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (while w3-p-s-overrides
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (setq w3-p-s-var (car (car w3-p-s-overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (setq w3-p-s-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 (cons (cons w3-p-s-var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (symbol-value w3-p-s-var))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 w3-p-s-undo-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (set w3-p-s-var (if (car (cdr (car w3-p-s-overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (cdr (cdr (car w3-p-s-overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 (append (cdr (cdr (car w3-p-s-overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 (symbol-value w3-p-s-var))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 ;; *** HACK HACK.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 ;; Magic handling of w3-p-d-shortref-chars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (cond ((eq 'w3-p-d-shortref-chars w3-p-s-var)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (setq w3-p-s-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 (cons (cons 'w3-p-d-non-markup-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 w3-p-d-non-markup-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 w3-p-s-undo-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (w3-update-non-markup-chars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (setq w3-p-s-overrides (cdr w3-p-s-overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 (w3-set-element-undo-list w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 w3-p-s-undo-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 ;; Handle content-model inheritance. (Very non-SGML!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 (if (eq 'XINHERIT (w3-element-content-model w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 (w3-set-element-content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 (w3-element-content-model (car w3-p-d-open-element-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
821 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 ;; The protocol for handing items to the display engine is as follows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 ;; For an element, send (START-TAG . ATTS), each member of the content,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 ;; and (END-TAG . nil) if the element is allowed to have an end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; For data characters, send (text . DATA-CHARACTERS).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 ;; Exceptions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 ;; For PLAINTEXT, STYLE, XMP, TEXTAREA send:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 ;; (START-TAG . ((data . DATA-CHARACTERS) . ATTS)).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 ;; *** This requires somehow eliminating any subelements of the TEXTAREA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 ;; element. TEXTAREA can contain subelements in HTML 3.0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 ;; For LISTING, send (text . DATA-CHARACTERS). (Is this really correct or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 ;; is this perhaps a bug in the old parser?) I'm ignoring this for now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 (w3-p-s-var-def w3-p-s-undo-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 (w3-p-s-var-def w3-p-s-content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 (w3-p-s-var-def w3-p-s-end-tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 ;; Modifies free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 ;; w3-p-d-current-element, w3-p-d-open-element-stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 ;; Accesses free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 ;; w3-p-d-tag-name, w3-p-d-end-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 ;; Destroys free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 ;; w3-p-s-undo-list, w3-p-s-content, w3-p-s-end-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 (defsubst w3-close-element (&optional inferred)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 ;; inferred: non-nil if the end-tag of the current element is being
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 ;; inferred due to the presence of content not allowed in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 ;; element. If t, then the tag causing this is in w3-p-d-tag-name and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 ;; w3-p-d-end-tag-p.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 ;; (OLD: ... otherwise it is a symbol indicating the start-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;; of an element or *data or *space indicating data characters.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 (cond ((and inferred
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 (not (w3-element-end-tag-omissible w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 (format "</%s> end-tag not omissible (required due to %s)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 (w3-sgml-name-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (w3-element-name w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 (cond ((eq t inferred)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 (format (if w3-p-d-end-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 "</%s> end-tag"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 "start-tag for %s")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 (w3-sgml-name-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 w3-p-d-tag-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 ;; *** Delete this functionality?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 ((memq inferred '(*space *data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 "data characters")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 ((symbolp inferred)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 (format "start-tag for %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 (w3-sgml-name-to-string inferred)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 ;; Undo any variable bindings of this element.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 (cond ((w3-element-undo-list w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 (setq w3-p-s-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 (w3-element-undo-list w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 (while w3-p-s-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 (set (car (car w3-p-s-undo-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 (cdr (car w3-p-s-undo-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (setq w3-p-s-undo-list (cdr w3-p-s-undo-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 (setq w3-p-s-end-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 (w3-element-end-tag-name w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 ;; Fix up the content of the current element in preparation for putting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 ;; it in the parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ;; Remove trailing newline from content, if there is one, otherwise send
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 ;; any trailing data character item to display engine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 (setq w3-p-s-content (w3-element-content w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 (cond ((null w3-p-s-content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 ((equal "\n" (car w3-p-s-content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 (setq w3-p-s-content (cdr w3-p-s-content)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
900 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
902 (cond ;; *** Handle LISTING the way the old parser did.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 ((eq 'EMPTY (w3-element-content-model w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 ;; Do nothing, can't have an end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 ;; Normal case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 (if (null w3-p-s-content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 :bad-style :outer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 ;; Don't warn for empty TD elements or empty A elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 ;; with no HREF attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 ;; *** Crude hack that should really be encoded in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 ;; element database somehow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (if (or (not (memq (w3-element-name w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 '(a td)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 (assq 'href
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 (w3-element-attributes w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 (format "Empty %s element."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 (w3-sgml-name-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (w3-element-name w3-p-d-current-element))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;; Put the current element in the proper place in its parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ;; This will cause an error if we overpop the stack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 (w3-set-element-content
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 (car w3-p-d-open-element-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 (cons (list (w3-element-name w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 (w3-element-attributes w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 (nreverse w3-p-s-content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (w3-element-content (car w3-p-d-open-element-stack))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 ;; Pop the stack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 (setq w3-p-d-current-element (car w3-p-d-open-element-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 (setq w3-p-d-open-element-stack (cdr w3-p-d-open-element-stack)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 ;;; A pseudo-DTD for HTML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 ;; This works around the following bogus compiler complaint:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;; While compiling the end of the data in file w3-parse.el:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;; ** the function w3-expand-parameters is not known to be defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ;; This is a bogus error. Anything of this form will trigger this message:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ;; (eval-when-compile (defun xyzzy () (xyzzy)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 (defun w3-expand-parameters (pars data) nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 (defun w3-expand-parameters (pars data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 (cond ((null data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ((consp data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 ;; This has to be written carefully to avoid exceeding the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 ;; maximum lisp function call nesting depth.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 (let (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 (while (consp data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 (let ((car-exp (w3-expand-parameters pars (car data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 (setq result
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 (if (and (symbolp (car data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (not (eq car-exp (car data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 ;; An expansion occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 (listp car-exp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 ;; The expansion was a list, which we splice in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 (condition-case err
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (append (reverse car-exp) result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (wrong-type-argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 (if (eq 'listp (nth 1 err))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 ;; Wasn't really a "list" since the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ;; cdr wasn't nil, so don't try to splice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 ;; it in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (cons car-exp result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (signal (car err) (cdr err)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (cons car-exp result))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (setq data (cdr data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (append (nreverse result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (w3-expand-parameters pars data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 ((symbolp data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (let ((sym-exp (cdr-safe (assq data pars))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 (if sym-exp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (w3-expand-parameters pars sym-exp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 ((vectorp data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 (let ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 (result (copy-sequence data)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 (while (< i (length data))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (aset result i
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (w3-expand-parameters pars (aref data i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 result))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 data))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 (defun w3-unfold-dtd (items)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (let (result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (while items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (let* ((item (car items))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (names (car item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 (content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (or (cdr-safe (assq 'content-model item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (error "impossible")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 (overrides (cdr-safe (assq 'overrides item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 (end-tag-omissible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 (or (cdr-safe (assq 'end-tag-omissible item))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 ;; *** Is this SGML standard?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (eq 'EMPTY content-model)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (deprecated (cdr-safe (assq 'deprecated item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 (while names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (setq name (car names))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (setq names (cdr names))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 ;; Create and initialize the element information data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 ;; structure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 (setq element (w3-make-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 (w3-set-element-name element name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 (w3-set-element-end-tag-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (intern (concat "/" (symbol-name name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (w3-set-element-state element 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (w3-set-element-content-model element content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 (w3-set-element-end-tag-omissible element end-tag-omissible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (or (memq deprecated '(nil t obsolete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 (error "impossible"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 (w3-set-element-deprecated element deprecated)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 ;; Inclusions and exclusions are specified differently in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 ;; human-coded DTD than in the format the implementation uses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 ;; The human-coded version is designed to be easy to edit and to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 ;; work with w3-expand-parameters while the internal version is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 ;; designed to be fast. We have to translate here. This work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 ;; is repeated for every element listed in `names' so that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 ;; exclusion exception error messages can be accurate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (let ((inclusions (cdr-safe (assq 'inclusions item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (exclusions (cdr-safe (assq 'exclusions item)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (exclusion-mode '*close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 (exclusion-message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (format "%s exclusion" (w3-sgml-name-to-string name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 exceptions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 (while inclusions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 (setq exceptions (cons (cons (car inclusions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 '(*include *same nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 exceptions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 (setq inclusions (cdr inclusions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (while exclusions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 (cond ((memq (car exclusions) '(*discard *include *close))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 (setq exclusion-mode (car exclusions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 ((stringp (car exclusions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 (setq exclusion-message (car exclusions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (setq exceptions (cons (list (car exclusions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 exclusion-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 '*same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 exclusion-message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 exceptions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (setq exclusions (cdr exclusions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 (let ((overrides (if exceptions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 (cons (cons 'w3-p-d-exceptions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 (cons nil exceptions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 overrides)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 (w3-set-element-overrides element overrides)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 (setq result (cons (cons name element) result))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 (setq items (cdr items)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 ;; Load the HTML DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 ;; <URL:ftp://ds.internic.net/rfc/rfc1866.txt>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 ;; *** Be sure to incorporate rfc1867 when attribute-checking is added.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 ;; *** Write function to check sanity of the content-model forms.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 ;; *** I18N: Add Q, BDO, SPAN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (lambda (pair)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (put (car pair) 'html-element-info (cdr pair))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 ;; The purpose of this complexity is to speed up loading by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 ;; pre-evaluating as much as possible at compile time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (w3-unfold-dtd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 (w3-expand-parameters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (%headempty . (link base meta range))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1089 (%headmisc . (script))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 (%head-deprecated . (nextid))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 ;; client-side imagemaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 (%imagemaps . (area map))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1094 (%input.fields . (input select textarea keygen label))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 ;; special action is taken for %text inside %body.content in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 ;; content model of each element.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1097 (%body.content . (%heading %block style hr div address %imagemaps))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (%heading . (h1 h2 h3 h4 h5 h6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 ;; Emacs-w3 extensions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 (%emacsw3-crud . (pinhead flame cookie yogsothoth hype peek))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1104 (%block . (p %list dl form %preformatted
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 %blockquote isindex fn table fig note
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1106 multicol center %block-deprecated %block-obsoleted))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (%list . (ul ol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (%preformatted . (pre))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 (%blockquote . (bq))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (%block-deprecated . (dir menu blockquote))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 (%block-obsoleted . (xmp listing))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 ;; Why is IMG in this list?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 (%pre.exclusion . (*include img *discard tab math big small sub sup))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1116 (%text . (*data b %notmath sub sup %emacsw3-crud %input.fields))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 (%notmath . (%special %font %phrase %misc))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1118 (%font . (i u s strike tt big small sub sup font
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1119 roach secret wired)) ;; B left out for MATH
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1120 (%phrase . (em strong dfn code samp kbd var cite blink))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1121 (%special . (a img applet object font basefont br script style map math tab span bdo))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1122 (%misc . (q lang au person acronym abbrev ins del))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 (%formula . (*data %math))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 (%math . (box above below %mathvec root sqrt array sub sup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 %mathface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 (%mathvec . (vec bar dot ddot hat tilde))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 (%mathface . (b t bt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 (%mathdelims . (over atop choose left right of))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 ;; What the hell? This takes BODYTEXT????? No way!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 (%bq-content-model . [(nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 (((bodytext) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 (bodytext *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 (((credit) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 (nil nil nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 ])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 ;; non-default bad HTML handling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 (%in-text-ignore . ((p %heading) *discard *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 ;; A dummy element that will contain *document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 ((*holder)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 (content-model . [(nil nil nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 ;; The root of the parse tree. We start with a pseudo-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 ;; named *document for convenience.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 ((*document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 (content-model . [(nil nil (((html) *include *next)) (html *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 (*include *same "after document end"))])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ;; HTML O O (HEAD, BODY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 ((html)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 (content-model . [(nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 (((head) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 (head *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 (((body) *include *next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 ;; Netscape stuff
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 ((frameset) *include 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 (body *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 (((plaintext) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 (*retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 (*include *same "after BODY"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 (*include *same "after FRAMESET"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 ])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 ((head)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1188 (content-model . [((title isindex %headempty %headmisc
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1189 style %head-deprecated)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 ;; *** Should only close if tag can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 ;; legitimately follow head. So many can that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 ;; I haven't bothered to enumerate them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 (*close))])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 (end-tag-omissible . t))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1197 ;; SCRIPT - - (#PCDATA)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1198 ((script)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1199 (content-model . XCDATA ; not official, but allows
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1200 ; comment hiding of script, and also
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1201 ; idiots that use '</' in scripts.
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1202 ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 ;; TITLE - - (#PCDATA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 ((title)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 (content-model . RCDATA ; not official
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 ;; [((*data) include-space nil nil)]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 ;; STYLE - O (#PCDATA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 ;; STYLE needs to be #PCDATA to allow omitted end tag. Bleagh.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 ((style)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1211 (content-model . CDATA)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 ((body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 (content-model . [((banner) nil nil (*retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 ((bodytext) nil nil (bodytext *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 (nil nil (((plaintext) *close)) nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 (inclusions . (spot))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 ;; Do I really want to include BODYTEXT? It has something to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 ;; with mixed content screwing things up, and I don't understand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 ;; it. Wait! It's used by BQ!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 ((bodytext)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 (((%text) p)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1227 ;; Some stupid sites put meta tags in the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1228 ;; middle of their documents. Sigh.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1229 ;; Allow it, but bitch and moan.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1230 ((meta) *include *same "not allowed here")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 ;; Closing when seeing CREDIT is a stupidity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 ;; caused by BQ's sharing of BODYTEXT. BQ
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 ;; should have its own BQTEXT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 ((credit plaintext) *close))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1235 nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1236 ])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 (end-tag-omissible . t))
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
1238 ((div banner center multicol)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 ((address)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (content-model . [((p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 (((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 ((%heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 nil)]))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1255 ((span bdo)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1256 (content-model . [((%text)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1257 include-space
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1258 nil
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1259 nil)])
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1260 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 ((p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 ;; *** Should only close if tag can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 ;; legitimately follow P. So many can that I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 ;; don't bother to enumerate here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 (*close))])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 ((ul ol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (content-model . [((lh)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 (((li) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 (*retry *next))
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1275 ((p)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1276 nil
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1277 nil
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1278 (*retry *next))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 ((li)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 ;; Push <LI> before data characters or block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 ;; elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 ;; Non-SGML.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1284 (;; ((p) b *same nil)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1285 ((%text %block) li *same error))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 ((lh)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (((dd dt li) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 ((dir menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 (content-model . [((li)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (((%text) li *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (exclusions . (%block))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (deprecated . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 ((li)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (content-model . [((%block)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 (((li) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 ((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 (end-tag-omissible . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 ;; Better bad HTML handling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 ;; Technically, there are a few valid documents that this will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 ;; hose, because you can have H1 inside FORM inside LI. However,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 ;; I don't think that should be allowed anyway.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (exclusions . (*discard "not allowed here" %heading)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 ((dl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 (content-model . [((lh)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 (((dt dd) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 (*retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 ((dt dd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 ;; Push <DD> before data characters or block
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 ;; items.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 ;; Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 (((%text %block) dd *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 ((dt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (((dd dt) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 (%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 ;; DD is just like LI, but we treat it separately because it can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 ;; followed by a different set of elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 ((dd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (content-model . [((%block)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 (((dt dd) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 ((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 (end-tag-omissible . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 ;; See comment with LI.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 (exclusions . (*discard "not allowed here" %heading)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 ((pre)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (content-model . [((%text hr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 (exclusions . (%pre.exclusion)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 ;; BLOCKQUOTE deprecated, BQ okay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 ((bq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (content-model . %bq-content-model))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 ((blockquote)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 (content-model . %bq-content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 ;; BLOCKQUOTE is deprecated in favor of BQ in the HTML 3.0 DTD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 ;; However, BQ is not even mentioned in the HTML 2.0 DTD. So I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 ;; don't think we can enable this yet:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 ;;(deprecated . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 ((fn note)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 (((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 ((fig)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 (content-model . [((overlay) nil nil (*retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 (((caption) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 (*retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (((figtext) *include *next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 ((credit) *retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 ;; *** Should only do this for elements that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 ;; can be in FIGTEXT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 (figtext *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 (nil nil (((credit) *include *next)) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 (nil nil nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 ((caption credit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 ((figtext)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 ;; Push <P> before data characters. Very non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 (((%text) p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 ((credit) *close))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 (end-tag-omissible . t))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1395 ((%emacsw3-crud basefont)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 ;; FORM - - %body.content -(FORM) +(INPUT|KEYGEN|SELECT|TEXTAREA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 ((form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 ;; Same as BODY. Ugh!
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1400 (content-model . [((%body.content %text)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 ;; Push <P> before data characters. Non-SGML.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
1403 nil
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (exclusions . (form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 (inclusions . (input select textarea keygen label)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 ;; *** Where is the URL describing this?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 ((label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 ;; *** These are already included, no need to repeat.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 ;;(inclusions . (input select textarea))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 ;; *** Is a LABEL allowed inside a LABEL? I assume no.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 (exclusions . (label))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 ;; The next line just does the default so is unneeded:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 ;;(end-tag-omissible . nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 ;; SELECT - - (OPTION+) -(INPUT|KEYGEN|TEXTAREA|SELECT)>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 ;; *** This should be -(everything).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 ((select)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (content-model . [((option) nil nil nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (exclusions . (input label select keygen textarea)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 ;; option - O (#PCDATA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 ;; needs to be #PCDATA to allow omitted end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 ((option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 ;; I'd like to make this RCDATA to avoid problems with inclusions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 ;; like SPOT, but that would conflict with the omitted end-tag, I
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 ;; think.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 (content-model . [((*data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 (((option) *close))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 ;; TEXTAREA - - (#PCDATA) -(INPUT|TEXTAREA|KEYGEN|SELECT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 ((textarea)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 ;; Same comment as for OPTION about RCDATA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 (content-model . [((*data) include-space nil nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 (exclusions . (input select label keygen textarea)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 ((hr br img isindex input keygen overlay wbr spot tab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 %headempty %mathdelims)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 ((nextid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 (content-model . EMPTY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 (deprecated . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 ((a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 (((%heading)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 *include *same "deprecated inside A")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 ;; *** I haven't made up my mind whether this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 ;; is a good idea. It can result in a lot of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 ;; bad formatting if the A is *never* closed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 ;;((p) *discard *same error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 (exclusions . (a)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1459 ((b font %font %phrase %misc nobr)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 ((plaintext)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 (content-model . XXCDATA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 (end-tag-omissible . t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 (deprecated . obsolete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 ((xmp listing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 (content-model . XCDATA)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 (deprecated . obsolete))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 ;; Latest table spec (as of Nov. 13 1995) is at:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 ;; <URL:ftp://ds.internic.net/internet-drafts/draft-ietf-html-tables-03.txt>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 ((table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 (content-model . [(nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (((caption) *include *next)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 98
diff changeset
1477 ((%text) tr *same error)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 ((col colgroup thead tfoot tbody tr) *retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 (*retry *next)) ;error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 ((col colgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (((thead tfoot tbody tr) *retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 (*retry *next)) ;error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (((thead) *include *next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 ((tfoot tbody tr) *retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 (*retry *next)) ;error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 (nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 (((tfoot) *include *next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 ((tbody tr) *retry *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 (*retry *next)) ;error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 ((tbody)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 (((tr) tbody *same)
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 114
diff changeset
1497 ((td th) tr *same)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 ;; error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 ((%body.content) tbody *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 ((colgroup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 (content-model . [((col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 (((colgroup thead tfoot tbody tr) *close))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 ((col)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 ((thead)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 (content-model . [((tr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 (((tfoot tbody) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 ;; error handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 ((%body.content) tr *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 ((tfoot tbody)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (content-model . [((tr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 (((tbody) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 ;; error handling
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
1522 ((td th) tr *same error)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 ((%body.content) tr *same error))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 ((tr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 (content-model . [((td th)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 (((tr tfoot tbody) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 ;; error handling
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 98
diff changeset
1531 ((%body.content %text) td *same error))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 ((td th)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 ;; Arrgh! Another %body.content!!! Stupid!!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 (((td th tr tfoot tbody) *close)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 ((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 ((math)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (content-model . [((*data) include-space nil nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 (overrides .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 ((w3-p-d-shortref-chars t . "\{_^")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 (w3-p-d-shortrefs t . (("\\^" . "<sup>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 ("_" . "<sub>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 ("{" . "<box>")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 (inclusions . (%math))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 (exclusions . (%notmath)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 ((sup)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 (overrides .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 ((w3-p-d-shortref-chars t . "\{_^")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 (w3-p-d-shortrefs t . (("\\^" . "</sup>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 ("_" . "<sub>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 ("{" . "<box>"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 ((sub)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 (content-model . [((%text)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 ((%in-text-ignore))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 (overrides .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 ((w3-p-d-shortref-chars t . "\{_^")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 (w3-p-d-shortrefs t . (("\\^" . "<sup>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 ("_" . "</sub>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 ("{" . "<box>"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 ((box)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 (content-model . [((%formula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 (((left) *include 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 ((over atop choose) *include 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 ((right) *include 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 ((%formula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 (((over atop choose) *include 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 ((right) *include 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 ((%formula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 (((right) *include 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 ((%formula) include-space nil nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 (overrides .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 ((w3-p-d-shortref-chars t . "{}_^")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 (w3-p-d-shortrefs t . (("\\^" . "<sup>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 ("_" . "<sub>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 ("{" . "<box>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 ("}" . "</box>"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 ((above below %mathvec t bt sqrt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 (content-model . [((%formula) include-space nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 ;; ROOT has a badly-specified content-model in HTML 3.0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 ((root)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 (content-model . [((%formula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 (((of) *include *next))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 ((%formula) include-space nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 ((of)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 (content-model . [((%formula) include-space nil nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 ;; There is no valid way to infer a missing end-tag for OF. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 ;; is bizarre.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 ((array)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 (content-model . [((row) nil nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 ((row)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 (content-model . [((item) nil (((row) *close)) nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 ((item)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 (content-model . [((%formula)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 include-space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 (((row item) *close))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 nil)])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 (end-tag-omissible . t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 ;; The old parser would look for the </EMBED> end-tag and include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 ;; the contents between <EMBED> and </EMBED> as the DATA attribute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 ;; of the EMBED start-tag. However, it did not require the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 ;; </EMBED> end-tag and did nothing if it was missing. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 ;; completely impossible to specify in SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 ;; See
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 ;; <URL:http://www.eit.com/goodies/lists/www.lists/www-html.1995q3/0603.html>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 ;; Questions: Does EMBED require the end-tag? How does NOEMBED fit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 ;; into this? Where can EMBED appear?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 ;; Nov. 25 1995: a new spec for EMBED (also an I-D):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 ;; <URL:http://www.cs.princeton.edu/~burchard/www/interactive/>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 ;; Here is my guess how to code EMBED:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 ((embed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 (content-model . [((noembed) nil nil (*close))]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 ((noembed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 (content-model . [((%body.content) ; hack hack hack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 (((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 ;; FRAMESET is a Netscape thing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 ;; <URL:http://www.eit.com/goodies/lists/www.lists/www-html.1995q3/0588.html>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 ((frameset)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 (content-model . [((noframes frame frameset) nil nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 ((noframes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (content-model . [((%body.content)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 ;; Push <P> before data characters. Non-SGML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 (((%text) p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 ((frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 ;; APPLET is a Java thing.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1658 ;; OBJECT is a cougar thing
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 ;; <URL:http://java.sun.com/JDK-beta/filesinkit/README>
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1660 ((applet object)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 ;; I really don't want to add another ANY content-model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 (content-model . XINHERIT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 (inclusions . (param)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 ((param)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 ;; backward compatibility with old Java.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 ((app)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 ;; Client-side image maps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 ;; <URL:ftp://ds.internic.net/internet-drafts/draft-seidman-clientsideimagemap-01.txt>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 ;; *** The only problem is that I don't know in what elements MAP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 ;; can appear, so none of this is reachable yet.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 ((map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 (content-model . [((area) nil nil nil)]))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 ((area)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 (content-model . EMPTY))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 )))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 ;;; Omitted tag inference using state transition tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 (w3-p-s-var-def w3-p-s-includep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 (w3-p-s-var-def w3-p-s-state-transitions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 (w3-p-s-var-def w3-p-s-transition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 (w3-p-s-var-def w3-p-s-tran-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 (w3-p-s-var-def w3-p-s-content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 (w3-p-s-var-def w3-p-s-except)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1692 (w3-p-s-var-def w3-p-s-baseobject)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1693 (w3-p-s-var-def w3-p-s-btdt)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 ;; Uses free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 ;; w3-p-d-current-element, w3-p-d-exceptions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 ;; Destroys free variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 ;; w3-p-s-includep, w3-p-s-state-transitions, w3-p-s-transition,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 ;; w3-p-s-tran-list, w3-p-s-content-model, w3-p-s-except
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 ;; Returns t if the element or data characters should be included.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 ;; Returns nil if the element or data characters should be discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 (defsubst w3-grok-tag-or-data (tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 ((symbolp (setq w3-p-s-content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 (w3-element-content-model w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 (or (and (memq w3-p-s-content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 '(CDATA RCDATA XCDATA XXCDATA))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 (memq tag-name '(*data *space)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 ;; *** Implement ANY.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1710 (error "impossible content model lossage"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 (setq w3-p-s-includep t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 ;; Exit loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 ;; We have a complex content model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 ;; Cache some data from the element info structure. Format is:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 ;; (INCLUDES INCSPACEP (((TAG ...) . TRANSITION) ...) DEFAULT)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 (setq w3-p-s-state-transitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 (aref w3-p-s-content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 (w3-element-state w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 ;; Optimize the common cases.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 ((eq '*space tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 ;; Optimizing the (*space *discard *same nil) transition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 (setq w3-p-s-includep (car (cdr w3-p-s-state-transitions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 ;; Don't loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 ((and (not (setq w3-p-s-except
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 (assq tag-name w3-p-d-exceptions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 (memq tag-name (car w3-p-s-state-transitions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 ;; Equivalent to a transition of (TAG *include *same nil).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 ;; So we are done, return t to caller.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 (setq w3-p-s-includep t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 ;; Exit loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 ;; The general case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 ;; Handle inclusions and exclusions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 (w3-p-s-except
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 (setq w3-p-s-transition (cdr w3-p-s-except)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 ;; See if the transition is in the complex transitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 ;; component.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 ((progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 (setq w3-p-s-tran-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 (car (cdr (cdr w3-p-s-state-transitions))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 (setq w3-p-s-transition nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 (while w3-p-s-tran-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 (cond ((memq tag-name (car (car w3-p-s-tran-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 ;; We've found a transition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 (setq w3-p-s-transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 (cdr (car w3-p-s-tran-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 (setq w3-p-s-tran-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 (setq w3-p-s-tran-list (cdr w3-p-s-tran-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 ;; Check if we found it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 w3-p-s-transition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 ;; body of cond clause empty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 ;; Try finding the transition in the DEFAULT component of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 ;; transition table, but avoid doing this for unknown elements,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 ;; always use the default-default for them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 ((and (or (eq '*data tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 (w3-known-element-p tag-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 (setq w3-p-s-transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 (nth 3 w3-p-s-state-transitions)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 ;; body of cond clause empty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 ;; Supply a default-default transition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 (if (not (or (eq '*data tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (w3-known-element-p tag-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 (setq w3-p-s-transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 '(*discard *same "unknown element"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 ;; Decide whether to *close or *discard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 ;; based on whether this element would be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 ;; accepted as valid in an open ancestor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 (let ((open-list w3-p-d-open-element-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 (all-end-tags-omissible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 (w3-element-end-tag-omissible w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 state-transitions tran-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 (if (catch 'found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 (while open-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 (setq state-transitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 (aref (w3-element-content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 (car open-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 (w3-element-state (car open-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (if (memq tag-name (car state-transitions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 (throw 'found t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 (setq tran-list (nth 2 state-transitions))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 (while tran-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (cond ((memq tag-name (car (car tran-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 (if (not (nth 3 (car tran-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 ;; Not an error transition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 (throw 'found t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (setq tran-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 (setq tran-list (cdr tran-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 ;; The input item is not accepted in this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 ;; ancestor. Try again in next ancestor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 (or (w3-element-end-tag-omissible (car open-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 (setq all-end-tags-omissible nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 (setq open-list (cdr open-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 (setq w3-p-s-transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 (if (w3-element-end-tag-omissible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 (if all-end-tags-omissible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 ;; Probably indicates a need to debug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 ;; the DTD state-transition tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 '(*close *same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 "missing transition in DTD?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 ;; Error will be reported later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 '(*close *same))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 '(*close *same "not allowed here")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 (setq w3-p-s-transition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 '(*discard *same "not allowed here")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 ;; We have found a transition to take. The transition is of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 ;; the format (ACTION NEW-STATE ERRORP) where the latter two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 ;; items are optional.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 ;; First, handle any state-change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 (or (memq (car-safe (cdr w3-p-s-transition)) '(nil *same))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 (w3-set-element-state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 (if (eq '*next (car-safe (cdr w3-p-s-transition)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 (1+ (w3-element-state w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 (car-safe (cdr w3-p-s-transition)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 ;; Handle any error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 (if (car-safe (cdr-safe (cdr w3-p-s-transition)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 :mandatory-if (and (eq '*data tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 (eq '*discard (car w3-p-s-transition)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 (format "Bad %s [%s], %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 (if (eq '*data tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 "data characters"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 (concat "start-tag "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 (w3-sgml-name-to-string tag-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 (if (stringp (car (cdr (cdr w3-p-s-transition))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 (car (cdr (cdr w3-p-s-transition)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 "not allowed here")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 (let ((action (car w3-p-s-transition)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 (cond ((eq '*discard action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 "discarding bad item")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 ((eq '*close action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 (concat "inferring </"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 (w3-sgml-name-to-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 (w3-element-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 ">"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 ((eq '*include action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 "including bad item anyway")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 ((eq '*retry action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 "*retry ??? you shouldn't see this")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 (concat "inferring <"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 (w3-sgml-name-to-string action)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 ">")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 ;; Handle the action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 ((eq '*include (car w3-p-s-transition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 (setq w3-p-s-includep t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 ;; Exit loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 ((eq '*close (car w3-p-s-transition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 ;; Perform end-tag inference.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 (w3-close-element) ; don't pass parameter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 ;; Loop and try again in parent element's content-model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 ((eq '*discard (car w3-p-s-transition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 (setq w3-p-s-includep nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 ;; Exit loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 ((eq '*retry (car w3-p-s-transition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 ;; Loop and try again after state change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 ((symbolp (car w3-p-s-transition))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 ;; We need to open another element to contain the text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 ;; probably a <P> (look in the state table).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 (w3-open-element (car w3-p-s-transition) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 ;; Now we loop and try again in the new element's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 ;; content-model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 (t
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1890 (error "impossible transition")))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 ;; Empty while loop body.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 ;; Return value to user indicating whether to include or discard item:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 ;; t ==> include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 ;; nil ==> discard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 w3-p-s-includep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 ;;; Main parser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 (defvar w3-last-parse-tree nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908 "Used for debugging only. Stores the most recently computed parse tree
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 \(a tree, not a parse tag stream\).")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 (defun w3-display-parse-tree (&optional ptree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 (with-output-to-temp-buffer "W3 HTML Parse Tree"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 (set-buffer standard-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 (emacs-lisp-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 (require 'pp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 (pp (or ptree w3-last-parse-tree))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 (defalias 'w3-display-last-parse-tree 'w3-display-parse-tree)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 ;; For compatibility with the old parser interface.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 (defalias 'w3-preparse-buffer 'w3-parse-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 ;; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 ;; % %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 ;; % This is the *ONLY* valid entry point in this file! %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 ;; % DO NOT call any of the other functions! %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 ;; % %
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 ;; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
1930 (defun w3-parse-buffer (&optional buff)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 "Parse contents of BUFF as HTML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 BUFF defaults to the value of url-working-buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 Destructively alters contents of BUFF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 Returns a data structure containing the parsed information."
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1935 (if (not w3-setup-done) (w3-do-setup))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 (set-buffer (or buff url-working-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 (setq buff (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 (set-syntax-table w3-sgml-md-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 (buffer-disable-undo (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 (widen) ; sanity checking
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1941 (goto-char (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 122
diff changeset
1942 (insert "\n")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 (setq case-fold-search t) ; allows smaller regexp patterns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 ;; Some unknown pre-parse buffer munging.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 (if (fboundp 'sera-to-fidel-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 (let ((sera-being-called-by-w3 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 ;; eval stops the compiler from complaining.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 (eval '(sera-to-fidel-marker))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 ;; *** Should premunge line boundaries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 ;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 (let* (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 ;; Speed hack, see the variable doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 (gc-cons-threshold (if (> w3-gc-cons-threshold-multiplier 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 (* w3-gc-cons-threshold-multiplier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 gc-cons-threshold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 gc-cons-threshold))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 ;; Used to determine if we made any progress since the last loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 (last-loop-start (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 ;; How many iterations of the main loop have occurred. Used only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 ;; to send messages to the user periodically, since this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 ;; can take some time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 (loop-count 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 ;; Precomputing the loop-invariant parts of this for speed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 (status-message-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 (if url-show-status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 (format "Parsed %%3d%%%% of %d..." (- (point-max) (point-min)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 ;; Use a float value for 100 if possible, otherwise integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 ;; Determine which we can use outside of the loop for speed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 (one-hundred (funcall (if (fboundp 'float) 'float 'identity) 100))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 ;; The buffer which contains the HTML we are parsing. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 ;; variable is used to avoid using the more expensive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 ;; save-excursion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 (parse-buffer (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 ;; Points to start of region of text since the previous tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 (between-tags-start (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 ;; Points past end of region of text since the previous tag. Only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 ;; non-nil when the region has been completely determined and is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 ;; ready to be processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 between-tags-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 w3-p-d-tag-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 w3-p-d-end-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 ;; Is the tag we are looking at a null-end-tag-enabling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 ;; start-tag?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 net-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 ;; Attributes of the tag we are looking at. An alist whose items
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 ;; are pairs of the form (SYMBOL . STRING).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 tag-attributes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 ;; Points past end of attribute value we are looking at. Points
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 ;; past the syntactic construct, not the value of the attribute,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 ;; which may be at (1- attribute-value-end).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 attribute-value-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 ;; Points past end of tag we are looking at.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 tag-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 (w3-p-d-current-element (w3-fresh-element-for-tag '*document))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 (w3-p-d-open-element-stack (list (w3-fresh-element-for-tag '*holder)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 ;; ***not implemented yet***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 (marked-section-undo-stack nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 (w3-p-d-debug-url t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 ;; Any of the following variables with the comment ";*NESTED*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 ;; are syntactic or semantic features that were introduced by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 ;; some containing element or marked section which will be undone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 ;; when we close that element or marked section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 (w3-p-d-non-markup-chars nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036 (w3-p-d-null-end-tag-enabled nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 (w3-p-d-in-parsed-marked-section nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 (w3-p-d-shortrefs nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 (w3-p-d-shortref-chars nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 ;; ******* maybe not needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 ;; ;; Are we recognizing start-tags?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 ;; (recognizing-start-tags t) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 ;; ;; Are we recognizing end-tags? If this is non-nil and not t,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 ;; ;; then only the end tag of the current open element is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 ;; ;; recognized.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 ;; (recognizing-end-tags t) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 ;; See doc string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 (w3-p-d-exceptions nil) ;*NESTED*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 ;; Scratch variables used in this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 ref attr-name attr-value content-model content open-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 ;; Scratch variables used by macros and defsubsts we call.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 (w3-p-s-let-bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 (w3-update-non-markup-chars)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2066 (setq w3-p-s-baseobject (url-generic-parse-url (url-view-url t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 ;; Main loop. Handle markup as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 ;; non-empty tag: Handle the region since the previous tag as PCDATA,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 ;; RCDATA, CDATA, if allowed by syntax. Then handle the tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 ;; general entity (&name;): expand it and parse the result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 ;; shortref (_, {, }, and ^ in math stuff): Expand it and parse the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 ;; result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 ;; SGML marked section (<![ keywords [ conditional-text ]]>): Either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 ;; strip the delimiters and parse the result or delete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 ;; comment: Delete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 ;; empty tag (<>, </>): Handle as the appropriate tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 ;; markup declaration (e.g. <!DOCTYPE ...>): Delete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 ;; SGML processing instruction (<?name>): Delete.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 ;; Continue as long as we processed something last time and we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 ;; have more to process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 (not (and (= last-loop-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 (eobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 (setq last-loop-start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 ;; Display progress messages if asked and/or do incremental display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 ;; of results
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 (cond ((= 0 (% (setq loop-count (1+ loop-count)) 40))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 (if status-message-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 (message status-message-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 ;; Percentage of buffer processed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 (/ (* (point) one-hundred) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 ;; Go to next interesting thing in the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 (skip-chars-forward w3-p-d-non-markup-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 ;; We are looking at a markup-starting character, and invalid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 ;; character, or end of buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2111 ((eq ?< (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 ;; We are looking at a tag, comment, markup declaration, SGML marked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114 ;; section, SGML processing instruction, or non-markup "<".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 (forward-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 ((looking-at "/?\\([a-z][-a-z0-9.]*\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 ;; We are looking at a non-empty tag.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2120
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2121 ;; Downcase it in the buffer, to save creation of a string
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2122 (downcase-region (match-beginning 1) (match-end 1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 (setq w3-p-d-tag-name
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2124 (intern (buffer-substring (match-beginning 1)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2125 (match-end 1))))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2126 (setq w3-p-d-end-tag-p (eq ?/ (char-after (point)))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2127 between-tags-end (1- (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 ;; Read the attributes from a start-tag.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2131 (if w3-p-d-end-tag-p
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2132 (if (looking-at "[ \t\r\n/]*[<>]")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2133 nil
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2134 ;; This is in here to deal with those idiots who stick
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2135 ;; attribute/value pairs on end tags. *sigh*
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2136 (w3-debug-html "Evil attributes on end tag.")
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2137 (skip-chars-forward "^>"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 ;; Attribute values can be:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 ;; "STRING" where STRING does not contain the double quote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 ;; 'STRING' where STRING does not contain the single quote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 ;; name-start character, *name character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143 ;; *name character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 ;; Digit, +name character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 ;; +Digit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 ;; or a SPACE-separated list of one of the last four
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 ;; possibilities (there is a comment somewhere that this is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 ;; misinterpretation of the grammar, so we ignore this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 ;; possibility).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 (while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 ;; Leading whitespace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 "[ \n\r\t]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 ;; The attribute name, possibly with a bad syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 ;; component.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2158 "\\([a-z_][-a-z0-9.]*\\(\\([_][-a-z0-9._]*\\)?\\)\\)"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 ;; Trailing whitespace and perhaps an "=".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160 "[ \n\r\t]*\\(\\(=[ \n\r\t]*\\)?\\)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162 (cond ((/= (match-beginning 2) (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 :nocontext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165 (format "Bad attribute name syntax: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 (match-end 1))))))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2168
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2169 ;; Downcase it in the buffer, to save creation of a string
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2170 (downcase-region (match-beginning 1) (match-end 1))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (setq attr-name
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2172 (intern (buffer-substring (match-beginning 1)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2173 (match-end 1))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 ((< (match-beginning 4) (match-end 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177 ;; A value was specified (e.g. ATTRIBUTE=VALUE).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 ((looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 ;; Literal with double quotes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 "\"\\([^\"]*\\)\""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 ;; Literal with single quotes.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2186 "'\\([^']*\\)'"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188 ;; Handle bad HTML conflicting with NET-enabling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 ;; start-tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190 "\\([-a-z0-9.]+/[-a-z0-9._/#]+\\)[ \t\n\r>]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 "\\|"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 ;; SGML NAME-syntax attribute value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 "\\([-a-z0-9.]+\\)[ \t\n\r></]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 ((or (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197 (match-beginning 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 ;; We have an attribute value literal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 (narrow-to-region (1+ (match-beginning 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 (1- (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 ;; In attribute value literals, EE and RS are ignored
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203 ;; and RE and SEPCHAR characters sequences are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 ;; replaced by SPACEs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 ;; (There is no way right now to get RS into one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207 ;; these so that it can be ignored. This is due to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 ;; our using Unix line-handling conventions.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 (skip-chars-forward "^&\t\n\r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 (if (eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212 ;; We must expand entities and replace RS, RE,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 ;; and SEPCHAR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216 (skip-chars-forward "^&")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 (not (eobp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 (w3-expand-entity-at-point-maybe))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2219 (subst-char-in-region (point-min) (point-max) ?\t ? )
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2220 (subst-char-in-region (point-min) (point-max) ?\n ? ))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 ;; Set this after we have changed the size of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222 ;; attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 (setq attribute-value-end (1+ (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 ((match-beginning 4)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 (setq attribute-value-end (match-end 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226 (narrow-to-region (point) attribute-value-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 ((match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 (setq attribute-value-end (match-end 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 (narrow-to-region (point) attribute-value-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 ;; Horribly illegal non-SGML handling of bad
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 ;; HTML on the net. This can break valid HTML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 (setq attr-value (buffer-substring (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233 (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 (w3-debug-html :nocontext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 (format "Evil attribute value syntax: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 (buffer-substring (point-min) (point-max)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237 (t
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2238 (error "impossible attribute value"))))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2239 ((memq (char-after (point)) '(?\" ?'))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 ;; Missing terminating quote character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 (narrow-to-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 (forward-char 1)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2244 (skip-chars-forward "^ \t\n\r'\"<>")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 (setq attribute-value-end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 (w3-debug-html :nocontext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247 (format "Attribute value missing end quote: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 (buffer-substring (point-min) (point-max))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (narrow-to-region (1+ (point-min)) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 ;; We have a syntactically invalid attribute value. Let's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252 ;; make a best guess as to what the author intended.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 (narrow-to-region (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 (progn
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2255 (skip-chars-forward "^ \t\n\r'\"<>")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 (setq attribute-value-end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 (w3-debug-html :nocontext
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258 (format "Bad attribute value syntax: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 (buffer-substring (point-min) (point-max))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 ;; Now we have isolated the attribute value. We need to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261 ;; munge the value depending on the syntax of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 ;; attribute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 ;; *** Right now, we only implement the necessary munging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264 ;; for CDATA attributes, which is none. I'm not sure why
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 ;; this happens to work for other attributes right now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 ;; For any other kind of attribute, we are supposed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 ;; * smash case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268 ;; * remove leading/trailing whitespace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 ;; * smash multiple space sequences into single spaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 ;; * verify the syntax of each token
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271 (setq attr-value (buffer-substring (point-min) (point-max)))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2272 (case attr-name
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2273 (class
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2274 (setq attr-value (split-string attr-value "[ ,]+")))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2275 (align
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2276 (if (string-match "^[ \t\r\n]*\\(.*\\)[ \t\r\n]*$"
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2277 attr-value)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2278 (setq attr-value (downcase
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2279 (substring attr-value
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2280 (match-beginning 1)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2281 (match-end 1))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2282 (setq attr-value (downcase attr-value)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2283 (setq attr-value (intern attr-value)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2284 ((src href)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2285 ;; I should expand URLs here
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2286 )
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2287 (otherwise nil)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2288 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 (goto-char attribute-value-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 ;; No value was specified, in which case NAME should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 ;; taken as ATTRIBUTE=NAME where NAME is one of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 ;; enumerated values for ATTRIBUTE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 ;; We assume here that ATTRIBUTE is the same as NAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 ;; *** Another piece of code will fix the attribute name if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 ;; is wrong.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 (setq attr-value (symbol-name attr-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 ;; Accumulate the attributes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 (setq tag-attributes (cons (cons attr-name attr-value)
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2302 tag-attributes)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2303
122
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2304 (if (and (eq w3-p-d-tag-name 'img)
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2305 (not (assq 'alt tag-attributes)))
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2306 (w3-debug-html :bad-style
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2307 :outer
d2f30a177268 Import from CVS: tag r20-1b14
cvs
parents: 120
diff changeset
2308 "IMG element has no ALT attribute"))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2309 (cond
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2310 ((and (eq w3-p-d-tag-name 'base)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2311 (setq w3-p-s-baseobject
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2312 (or (assq 'src tag-attributes)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2313 (assq 'href tag-attributes))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2314 (setq w3-p-s-baseobject (url-generic-parse-url
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2315 (cdr w3-p-s-baseobject))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2316 ((setq w3-p-s-btdt (or (assq 'src tag-attributes)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2317 (assq 'href tag-attributes)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2318 (assq 'action tag-attributes)))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2319 (setcdr w3-p-s-btdt (url-expand-file-name (cdr w3-p-s-btdt)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2320 w3-p-s-baseobject))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2321 (setq w3-p-s-btdt (if (url-have-visited-url (cdr w3-p-s-btdt))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2322 ":visited"
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2323 ":link"))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2324 (if (assq 'class tag-attributes)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2325 (setcdr (assq 'class tag-attributes)
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2326 (cons w3-p-s-btdt
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2327 (cdr (assq 'class tag-attributes))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2328 (setq tag-attributes (cons (cons 'class (list w3-p-s-btdt))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2329 tag-attributes))))
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2330 )
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2331 (if (not (eq w3-p-d-tag-name 'input))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2332 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2333 (setq w3-p-s-btdt (concat ":"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2334 (downcase
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2335 (or (cdr-safe
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2336 (assq 'type tag-attributes))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2337 "text"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2338 (if (assq 'class tag-attributes)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2339 (setcdr (assq 'class tag-attributes)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2340 (cons w3-p-s-btdt
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2341 (cdr (assq 'class tag-attributes))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2342 (setq tag-attributes (cons (cons 'class (list w3-p-s-btdt))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 82
diff changeset
2343 tag-attributes))))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2344 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 ;; Process the end of the tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 (skip-chars-forward " \t\n\r")
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2348 (cond ((eq ?> (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 ;; Ordinary tag end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350 (forward-char 1))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2351 ((and (eq ?/ (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 (not w3-p-d-end-tag-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353 ;; This is a NET-enabling start-tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 (setq net-tag-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 (forward-char 1))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2356 ((eq ?< (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 ;; *** Strictly speaking, the following text has to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 ;; lexically be STAGO or ETAGO, which means that it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 ;; can't match some other lexical unit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 ;; Unclosed tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 ;; Syntax error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365 (format "Bad unclosed %s%s tag"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 (if w3-p-d-end-tag-p "/" "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (w3-sgml-name-to-string w3-p-d-tag-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (setq tag-end (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371 ((looking-at "/?>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 ;; We are looking at an empty tag (<>, </>).
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2373 (setq w3-p-d-end-tag-p (eq ?/ (char-after (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 (setq w3-p-d-tag-name (if w3-p-d-end-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 (w3-element-name w3-p-d-current-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376 ;; *** Strictly speaking, if OMITTAG NO, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 ;; we should use the most recently closed tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 ;; But OMITTAG YES in HTML and I'm lazy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 (w3-element-name w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380 (setq tag-attributes nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 ;; *** Make sure this is not at top level.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 (setq between-tags-end (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 (setq tag-end (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 ;; *** In SGML, <(doctype)element> is valid tag syntax. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 ;; cannot occur in HTML because the CONCUR option is off in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 ;; SGML declaration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 ((looking-at "!--")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 ;; We found a comment, delete to end of comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 (1- (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 ;; Skip over pairs of -- ... --.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 (if (looking-at "\\(--[^-]*\\(-[^-]+\\)*--[ \t\r\n]*\\)+>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 (goto-char (match-end 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398 ;; Syntax error!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 "Bad comment (unterminated or unbalanced \"--\" pairs)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 (forward-char 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 (or (re-search-forward "--[ \t\r\n]*>" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 (search-forward ">" nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 ((looking-at "!>\\|\\?[^>]*>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 ;; We are looking at an empty comment or a processing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 ;; instruction. Delete it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 (replace-match "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 (delete-char -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 ((looking-at "![a-z]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 ;; We are looking at a markup declaration. Delete it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 ;; *** Technically speaking, to handle valid HTML I think we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415 ;; need to handle "<!USEMAP ... >" declarations. In the future,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 ;; to handle general SGML, we should parse "<!DOCTYPE ... >"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 ;; declarations as well (which can contain other declarations).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 ;; In the very distant future, perhaps we will handle "<!SGML
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 ;; ... >" declarations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420 ;; *** Should warn if it's not SGML, DOCTYPE, or USEMAP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 (forward-sexp 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 ;; *** This might not actually be bad syntax, but might
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429 ;; instead be a -- ... -- comment with unbalanced
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 ;; parentheses somewhere inside the declaration. Handling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 ;; this properly would require full parsing of markup
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 ;; declarations, a goal for the future.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 (w3-debug-html "Bad <! syntax.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434 (skip-chars-forward "^>")
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2435 (if (eq ?> (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 (forward-char))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 ((looking-at "!\\\[\\(\\([ \t\n\r]*[a-z]+\\)+[ \t\n\r]*\\)\\\[")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 ;; We are looking at a marked section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 ;; *** Strictly speaking, we should issue a warning if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 ;; keywords are invalid or missing or if the "[" does not follow.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443 ;; We must look at the keywords to understand how to parse it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 ;; *** Strictly speaking, we should perform parameter entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 ;; substitution on the keywords first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 (goto-char (match-beginning 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 (insert ?\))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 (goto-char (1- (match-beginning 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 (delete-char 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450 (insert ?\()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 (let* ((keywords (read (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 ;; Multiple keywords may appear, but only the most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 ;; significant takes effect. Rank order is IGNORE, CDATA,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455 ;; RCDATA, INCLUDE, and TEMP. INCLUDE and TEMP have the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 ;; same effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 (keyword (car-safe (cond ((memq 'IGNORE keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 ((memq 'CDATA keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 ((memq 'RCDATA keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 ((memq 'INCLUDE keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 ((memq 'TEMP keywords))))))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2462 (or (eq ?\[ (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 ;; I probably shouldn't even check this, since it is so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 ;; impossible.
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2465 (error "impossible ??"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466 (forward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 (delete-region (1- (match-beginning 0)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 (cond ((eq 'IGNORE keyword)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469 ;; Scan forward skipping over matching <![ ... ]]>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 ;; until we find an unmatched "]]>".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 (let ((ignore-nesting 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 (start-pos (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473 (while (> ignore-nesting 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 (if (re-search-forward "<!\\\\\[\\|\]\]>" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (setq ignore-nesting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 (if (eq ?> (preceding-char))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477 (1- ignore-nesting)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 (1+ ignore-nesting)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 "Unterminated IGNORE marked section.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481 (setq ignore-nesting 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 (goto-char start-pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 (delete-region start-pos (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 ((eq 'CDATA keyword)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 (error "***unimplemented***"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 ((eq 'RCDATA keyword)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 (error "***unimplemented***"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488 ((memq keyword '(INCLUDE TEMP))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 (error "***unimplemented***")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490 ((and (looking-at "!")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 w3-netscape-compatible-comments)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 ;; Horribly illegal non-SGML handling of bad HTML on the net.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 ;; This can break valid HTML.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 ;; This arises because Netscape discards anything looking like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 ;; "<!...>". So people expect they can use this construct as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496 ;; a comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 (w3-debug-html "Evil <! comment syntax.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498 (backward-char 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 (delete-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 (point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 (skip-chars-forward "^>")
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2503 (if (eq ?> (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 (forward-char))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 ;; This < is not a markup character. Pretend we didn't notice
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 ;; it at all. We have skipped over the < already, so just loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 ;; again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2512 ((eq ?& (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 (w3-expand-entity-at-point-maybe))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2515 ((and (eq ?\] (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 w3-p-d-in-parsed-marked-section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 (looking-at "]]>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 ;; *** handle the end of a parsed marked section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519 (error "***unimplemented***"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2521 ((and (eq ?/ (char-after (point)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 w3-p-d-null-end-tag-enabled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 ;; We are looking at a null end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524 (setq w3-p-d-end-tag-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 (setq between-tags-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 (setq tag-end (1+ (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 (setq w3-p-d-tag-name (w3-element-name w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 ;; This can be slow, since we'll hardly ever get here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530 ;; *** Strictly speaking, I think we're supposed to handle
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 ;; shortrefs that begin with the same characters as other markup,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 ;; preferring the longest match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 ;; I will assume that shortrefs never begin with <, &, \], /.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 ((setq ref (catch 'found-shortref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535 (let ((refs w3-p-d-shortrefs))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 (while refs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 (if (looking-at (car (car refs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538 (throw 'found-shortref (cdr (car refs))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 (setq refs (cdr refs))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 ;; We are looking at a shortref for which there is an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 ;; expansion defined in the current syntax. Replace with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 ;; expansion, leaving point at the beginning so it will be parsed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 ;; on the next loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544 ;; *** eek. This is wrong if the shortref is for an entity with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 ;; CDATA syntax which should not be reparsed for tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 (replace-match "")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 (let ((pt (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548 (insert ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 (goto-char pt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 ((looking-at (eval-when-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552 (concat "[" (w3-invalid-sgml-chars) "]")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 (w3-debug-html
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2554 (format "Invalid SGML character: %c" (char-after (point))))
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2555 (insert (or (cdr-safe (assq (char-after (point))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 ;; These characters are apparently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557 ;; from a Windows character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558 '((146 . "'")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559 (153 . "TM"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 (delete-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 ((eobp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 ;; We have finished the buffer. Make sure we process the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565 ;; piece of text, if any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 (setq between-tags-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 ;; We have to test what's on the element stack because this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 ;; piece of code gets executed twice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569 (cond ((not (eq '*holder (w3-element-name w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 ;; This forces the calculation of implied omitted end tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 (setq w3-p-d-tag-name '*document)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572 (setq w3-p-d-end-tag-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573 (setq tag-end (point)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576 (error "unreachable code, this can't happen")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 ;; If we have determined the boundaries of a non-empty between-tags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 ;; region of text, then handle it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 (between-tags-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 ((< between-tags-start between-tags-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584 ;; We have a non-empty between-tags region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 ;; We check if it's entirely whitespace, because we record the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 ;; transitions for whitespace separately from those for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588 ;; data with non-whitespace characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 (goto-char between-tags-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 (skip-chars-forward " \t\n\r" between-tags-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592 ((w3-grok-tag-or-data (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593 (if (= between-tags-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 '*space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595 '*data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596 (goto-char between-tags-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 ;; We have to include the text in the current element's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 ;; contents. If this is the first item in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599 ;; element's contents, don't include a leading newline if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 ;; there is one. Add a trailing newline as a separate text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 ;; item so that it can be removed later if it turns out to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 ;; be the last item in the current element's contents when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 ;; the current element is closed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 ;; *** We could perform this test before calling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 ;; w3-grok-tag-or-data, but it's not clear which will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 ;; faster in practice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607 (or (setq content (w3-element-content w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 ;; *** Strictly speaking, in SGML the record end is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609 ;; carriage return, not line feed.
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2610 (if (eq ?\n (char-after between-tags-start))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 (setq between-tags-start (1+ between-tags-start))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612 (if (= between-tags-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 ;; Do nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 ;; We are definitely going to add data characters to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 ;; content.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 ((and (= ?\n (preceding-char))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 (/= between-tags-start (1- (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 (setq content (cons (buffer-substring between-tags-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 (1- (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 content))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 (setq content (cons "\n" content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 (setq content (cons (buffer-substring between-tags-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627 content))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 (w3-set-element-content w3-p-d-current-element content))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 (setq between-tags-end nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 ;; If the previous expression modified (point), then it went to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633 ;; the value of between-tags-end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635 ;; If we found a start or end-tag, we need to handle it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 (w3-p-d-tag-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639 ;; Move past the tag and prepare for next between-tags region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 (goto-char tag-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 (setq between-tags-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644 (w3-p-d-end-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 ;; Handle an end-tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 (if (eq w3-p-d-tag-name (w3-element-name w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647 (w3-close-element)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 ;; Handle the complex version. We have to search up (down?)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 ;; the open element stack to find the element that matches (if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 ;; any). Then we close all of the elements. On a conforming
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 ;; SGML document this can do no wrong and it's not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652 ;; unreasonable on a non-conforming document.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654 ;; Can't safely modify stack until we know the element we want
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 ;; to find is in there, so work with a copy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 (setq open-list w3-p-d-open-element-stack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 (while (and open-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 (not (eq w3-p-d-tag-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659 (w3-element-name (car open-list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660 (setq open-list (cdr open-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 (cond (open-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 ;; We found a match. Pop elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 ;; We will use the following value as a sentinel.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664 (setq open-list (cdr open-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 (while (not (eq open-list w3-p-d-open-element-stack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 (w3-close-element t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 (w3-close-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 ;; Bogus end tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670 (w3-debug-html
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 (format "Unmatched end-tag </%s>"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672 (w3-sgml-name-to-string w3-p-d-tag-name)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 ;; Handle a start-tag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 ;; Check if the new element is allowed in the current element's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 ;; content model.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 ((w3-grok-tag-or-data w3-p-d-tag-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679 (w3-open-element w3-p-d-tag-name tag-attributes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 ;; Handle NET-enabling start tags.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 (cond ((and net-tag-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 (not w3-p-d-null-end-tag-enabled))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684 ;; Save old values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 (w3-set-element-undo-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 w3-p-d-current-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 (cons (cons 'w3-p-d-non-markup-chars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 w3-p-d-non-markup-chars)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689 (cons '(w3-p-d-null-end-tag-enabled . nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 (w3-element-undo-list w3-p-d-current-element))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 ;; Alter syntax.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 (setq w3-p-d-null-end-tag-enabled t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693 (w3-update-non-markup-chars)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 (setq content-model
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 (w3-element-content-model w3-p-d-current-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698 ;; If the element does not have parsed contents, then we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 ;; can find its contents immediately.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 ((memq content-model '(EMPTY CDATA XCDATA XXCDATA RCDATA))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 ((eq 'EMPTY content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 (w3-close-element))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 ((eq 'CDATA content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 ;; CDATA: all data characters until an end-tag. We'll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 ;; process the end-tag on the next loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 (if (re-search-forward (if w3-p-d-null-end-tag-enabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 "</[a-z>]\\|/"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710 "</[a-z>]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 (goto-char (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 ((eq 'XCDATA content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 ;; XCDATA: special non-SGML-standard mode which includes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715 ;; all data characters until "</foo" is seen where "foo"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 ;; is the name of this element (for XMP and LISTING).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 (if (search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718 (concat "</" (symbol-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719 (w3-element-name w3-p-d-current-element)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 (goto-char (match-beginning 0))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 ((eq 'XXCDATA content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 ;; XXCDATA: special non-SGML-standard mode which includes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724 ;; all data until end-of-entity (end-of-buffer for us)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 ;; (for PLAINTEXT).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726 (goto-char (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 ((eq 'RCDATA content-model)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728 ;; RCDATA: all data characters until end-tag is seen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 ;; except that entities are expanded first, although the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 ;; expansions are _not_ scanned for end-tags, although the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 ;; expansions _are_ scanned for further entity
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 ;; references.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733 (while (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 (if (re-search-forward (if w3-p-d-null-end-tag-enabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735 "</[a-z>]\\|[/&]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 "</[a-z>]\\|&")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 nil 'move)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 (goto-char (match-beginning 0)))
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 108
diff changeset
2739 (eq ?& (char-after (point))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 (w3-expand-entity-at-point-maybe)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 ;; The element is illegal here. We'll just discard the start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 ;; tag as though we never saw it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 (setq w3-p-d-tag-name nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 (setq w3-p-d-end-tag-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 (setq net-tag-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749 (setq tag-attributes nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 (setq tag-end nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752 ;; End of main while loop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 ;; We have finished parsing the buffer!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756 (if status-message-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 (message "%sdone" (format status-message-format 100)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759 ;; *** For debugging, save the true parse tree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 ;; *** Make this look inside *DOCUMENT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 (setq w3-last-parse-tree
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 (w3-element-content w3-p-d-current-element))
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2763
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 70
diff changeset
2764 (w3-element-content w3-p-d-current-element)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
2765 )))
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 2
diff changeset
2766
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 38
diff changeset
2767
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 (provide 'w3-parse)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 ;; Local variables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772 ;; indent-tabs-mode: nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 ;; end: