1- import string
1+ import string , gettext
2+ _ = gettext .gettext
23
34try :
45 frozenset
910
1011EOF = None
1112
13+ E = {
14+ "null-character" :
15+ _ (u"Null character in input stream, replaced with U+FFFD." ),
16+ "incorrectly-placed-solidus" :
17+ _ (u"Solidus (/) incorrectly placed in tag." ),
18+ "incorrect-cr-newline-entity" :
19+ _ (u"Incorrect CR newline entity, replaced with LF." ),
20+ "illegal-windows-1252-entity" :
21+ _ (u"Entity used with illegal number (windows-1252 reference)." ),
22+ "cant-convert-numeric-entity" :
23+ _ (u"Numeric entity couldn't be converted to character "
24+ u"(codepoint U+%(charAsInt)08x)." ),
25+ "illegal-codepoint-for-numeric-entity" :
26+ _ (u"Numeric entity represents an illegal codepoint: "
27+ u"U+%(charAsInt)08x." ),
28+ "numeric-entity-without-semicolon" :
29+ _ (u"Numeric entity didn't end with ';'." ),
30+ "expected-numeric-entity-but-got-eof" :
31+ _ (u"Numeric entity expected. Got end of file instead." ),
32+ "expected-numeric-entity" :
33+ _ (u"Numeric entity expected but none found." ),
34+ "named-entity-without-semicolon" :
35+ _ (u"Named entity didn't end with ';'." ),
36+ "expected-named-entity" :
37+ _ (u"Named entity expected. Got none." ),
38+ "attributes-in-end-tag" :
39+ _ (u"End tag contains unexpected attributes." ),
40+ "expected-tag-name-but-got-right-bracket" :
41+ _ (u"Expected tag name. Got '>' instead." ),
42+ "expected-tag-name-but-got-question-mark" :
43+ _ (u"Expected tag name. Got '?' instead. (HTML doesn't "
44+ u"support processing instructions.)" ),
45+ "expected-tag-name" :
46+ _ (u"Expected tag name. Got something else instead" ),
47+ "expected-closing-tag-but-got-right-bracket" :
48+ _ (u"Expected closing tag. Got '>' instead. Ignoring '</>'." ),
49+ "expected-closing-tag-but-got-eof" :
50+ _ (u"Expected closing tag. Unexpected end of file." ),
51+ "expected-closing-tag-but-got-char" :
52+ _ (u"Expected closing tag. Unexpected character '%(data)s' found." ),
53+ "eof-in-tag-name" :
54+ _ (u"Unexpected end of file in the tag name." ),
55+ "expected-attribute-name-but-got-eof" :
56+ _ (u"Unexpected end of file. Expected attribute name instead." ),
57+ "eof-in-attribute-name" :
58+ _ (u"Unexpected end of file in attribute name." ),
59+ "duplicate-attribute" :
60+ _ (u"Dropped duplicate attribute on tag." ),
61+ "expected-end-of-tag-name-but-got-eof" :
62+ _ (u"Unexpected end of file. Expected = or end of tag." ),
63+ "expected-attribute-value-but-got-eof" :
64+ _ (u"Unexpected end of file. Expected attribute value." ),
65+ "eof-in-attribute-value-double-quote" :
66+ _ (u"Unexpected end of file in attribute value (\" )." ),
67+ "eof-in-attribute-value-single-quote" :
68+ _ (u"Unexpected end of file in attribute value (')." ),
69+ "eof-in-attribute-value-no-quotes" :
70+ _ (u"Unexpected end of file in attribute value." ),
71+ "expected-dashes-or-doctype" :
72+ _ (u"Expected '--' or 'DOCTYPE'. Not found." ),
73+ "incorrect-comment" :
74+ _ (u"Incorrect comment." ),
75+ "eof-in-comment" :
76+ _ (u"Unexpected end of file in comment." ),
77+ "eof-in-comment-end-dash" :
78+ _ (u"Unexpected end of file in comment (-)" ),
79+ "unexpected-dash-after-double-dash-in-comment" :
80+ _ (u"Unexpected '-' after '--' found in comment." ),
81+ "eof-in-comment-double-dash" :
82+ _ (u"Unexpected end of file in comment (--)." ),
83+ "unexpected-char-in-comment" :
84+ _ (u"Unexpected character in comment found." ),
85+ "need-space-after-doctype" :
86+ _ (u"No space after literal string 'DOCTYPE'." ),
87+ "expected-doctype-name-but-got-right-bracket" :
88+ _ (u"Unexpected > character. Expected DOCTYPE name." ),
89+ "expected-doctype-name-but-got-eof" :
90+ _ (u"Unexpected end of file. Expected DOCTYPE name." ),
91+ "eof-in-doctype-name" :
92+ _ (u"Unexpected end of file in DOCTYPE name." ),
93+ "eof-in-doctype" :
94+ _ (u"Unexpected end of file in DOCTYPE." ),
95+ "expected-space-or-right-bracket-in-doctype" :
96+ _ (u"Expected space or '>'. Got '%(data)s'" ),
97+ "unexpected-end-of-doctype" :
98+ _ (u"Unexpected end of DOCTYPE." ),
99+ "unexpected-char-in-doctype" :
100+ _ (u"Unexpected character in DOCTYPE." ),
101+ "eof-in-bogus-doctype" :
102+ _ (u"Unexpected end of file in bogus doctype." ),
103+ "eof-in-innerhtml" :
104+ _ (u"XXX innerHTML EOF" ),
105+ "unexpected-doctype" :
106+ _ (u"Unexpected DOCTYPE. Ignored." ),
107+ "non-html-root" :
108+ _ (u"html needs to be the first start tag." ),
109+ "expected-doctype-but-got-eof" :
110+ _ (u"Unexpected End of file. Expected DOCTYPE." ),
111+ "unknown-doctype" :
112+ _ (u"Erroneous DOCTYPE." ),
113+ "expected-doctype-but-got-chars" :
114+ _ (u"Unexpected non-space characters. Expected DOCTYPE." ),
115+ "expected-doctype-but-got-start-tag" :
116+ _ (u"Unexpected start tag (%(name)s). Expected DOCTYPE." ),
117+ "expected-doctype-but-got-end-tag" :
118+ _ (u"Unexpected end tag (%(name)s). Expected DOCTYPE." ),
119+ "end-tag-after-implied-root" :
120+ _ (u"Unexpected end tag (%(name)s) after the (implied) root element." ),
121+ "expected-named-closing-tag-but-got-eof" :
122+ _ (u"Unexpected end of file. Expected end tag (%(name)s)." ),
123+ "two-heads-are-not-better-than-one" :
124+ _ (u"Unexpected start tag head in existing head. Ignored." ),
125+ "unexpected-end-tag" :
126+ _ (u"Unexpected end tag (%(name)s). Ignored." ),
127+ "unexpected-start-tag-out-of-my-head" :
128+ _ (u"Unexpected start tag (%(name)s) that can be in head. Moved." ),
129+ "unexpected-start-tag" :
130+ _ (u"Unexpected start tag (%(name)s)." ),
131+ "missing-end-tag" :
132+ _ (u"Missing end tag (%(name)s)." ),
133+ "missing-end-tags" :
134+ _ (u"Missing end tags (%(name)s)." ),
135+ "unexpected-start-tag-implies-end-tag" :
136+ _ (u"Unexpected start tag (%(startName)s) "
137+ u"implies end tag (%(endName)s)." ),
138+ "unexpected-start-tag-treated-as" :
139+ _ (u"Unexpected start tag (%(originalName)s). Treated as %(newName)s." ),
140+ "deprecated-tag" :
141+ _ (u"Unexpected start tag %(name)s. Don't use it!" ),
142+ "unexpected-start-tag-ignored" :
143+ _ (u"Unexpected start tag %(name)s. Ignored." ),
144+ "expected-one-end-tag-but-got-another" :
145+ _ (u"Unexpected end tag (%(gotName)s). "
146+ u"Missing end tag (%(expectedName)s)." ),
147+ "end-tag-too-early" :
148+ _ (u"End tag (%(name)s) seen too early. Expected other end tag." ),
149+ "end-tag-too-early-named" :
150+ _ (u"Unexpected end tag (%(gotName)s). Expected end tag (%(expectedName)s)." ),
151+ "end-tag-too-early-ignored" :
152+ _ (u"End tag (%(name)s) seen too early. Ignored." ),
153+ "adoption-agency-1.1" :
154+ _ (u"End tag (%(name)s) violates step 1, "
155+ u"paragraph 1 of the adoption agency algorithm." ),
156+ "adoption-agency-1.2" :
157+ _ (u"End tag (%(name)s) violates step 1, "
158+ u"paragraph 2 of the adoption agency algorithm." ),
159+ "adoption-agency-1.3" :
160+ _ (u"End tag (%(name)s) violates step 1, "
161+ u"paragraph 3 of the adoption agency algorithm." ),
162+ "unexpected-end-tag-treated-as" :
163+ _ (u"Unexpected end tag (%(originalName)s). Treated as %(newName)s." ),
164+ "no-end-tag" :
165+ _ (u"This element (%(name)s) has no end tag." ),
166+ "unexpected-implied-end-tag-in-table" :
167+ _ (u"Unexpected implied end tag (%(name)s) in the table phase." ),
168+ "unexpected-implied-end-tag-in-table-body" :
169+ _ (u"Unexpected implied end tag (%(name)s) in the table body phase." ),
170+ "unexpected-char-implies-table-voodoo" :
171+ _ (u"Unexpected non-space characters in "
172+ u"table context caused voodoo mode." ),
173+ "unexpected-start-tag-implies-table-voodoo" :
174+ _ (u"Unexpected start tag (%(name)s) in "
175+ u"table context caused voodoo mode." ),
176+ "unexpected-end-tag-implies-table-voodoo" :
177+ _ (u"Unexpected end tag (%(name)s) in "
178+ u"table context caused voodoo mode." ),
179+ "unexpected-cell-in-table-body" :
180+ _ (u"Unexpected table cell start tag (%(name)s) "
181+ u"in the table body phase." ),
182+ "unexpected-cell-end-tag" :
183+ _ (u"Got table cell end tag (%(name)s) "
184+ u"while required end tags are missing." ),
185+ "unexpected-end-tag-in-table-body" :
186+ _ (u"Unexpected end tag (%(name)s) in the table body phase. Ignored." ),
187+ "unexpected-implied-end-tag-in-table-row" :
188+ _ (u"Unexpected implied end tag (%(name)s) in the table row phase." ),
189+ "unexpected-end-tag-in-table-row" :
190+ _ (u"Unexpected end tag (%(name)s) in the table row phase. Ignored." ),
191+ "unexpected-select-in-select" :
192+ _ (u"Unexpected select start tag in the select phase "
193+ u"implies select start tag." ),
194+ "unexpected-start-tag-in-select" :
195+ _ (u"Unexpected start tag token (%(name)s in the select phase. "
196+ u"Ignored." ),
197+ "unexpected-end-tag-in-select" :
198+ _ (u"Unexpected end tag (%(name)s) in the select phase. Ignored." ),
199+ "unexpected-char-after-body" :
200+ _ (u"Unexpected non-space characters in the after body phase." ),
201+ "unexpected-start-tag-after-body" :
202+ _ (u"Unexpected start tag token (%(name)s)"
203+ u" in the after body phase." ),
204+ "unexpected-end-tag-after-body" :
205+ _ (u"Unexpected end tag token (%(name)s)"
206+ u" in the after body phase." ),
207+ "unexpected-char-in-frameset" :
208+ _ (u"Unepxected characters in the frameset phase. Characters ignored." ),
209+ "unexpected-start-tag-in-frameset" :
210+ _ (u"Unexpected start tag token (%(name)s)"
211+ u" in the frameset phase. Ignored." ),
212+ "unexpected-frameset-in-frameset-innerhtml" :
213+ _ (u"Unexpected end tag token (frameset) "
214+ u"in the frameset phase (innerHTML)." ),
215+ "unexpected-end-tag-in-frameset" :
216+ _ (u"Unexpected end tag token (%(name)s)"
217+ u" in the frameset phase. Ignored." ),
218+ "unexpected-char-after-frameset" :
219+ _ (u"Unexpected non-space characters in the "
220+ u"after frameset phase. Ignored." ),
221+ "unexpected-start-tag-after-frameset" :
222+ _ (u"Unexpected start tag (%(name)s)"
223+ u" in the after frameset phase. Ignored." ),
224+ "unexpected-end-tag-after-frameset" :
225+ _ (u"Unexpected end tag (%(name)s)"
226+ u" in the after frameset phase. Ignored." ),
227+ "expected-eof-but-got-char" :
228+ _ (u"Unexpected non-space characters. Expected end of file." ),
229+ "expected-eof-but-got-start-tag" :
230+ _ (u"Unexpected start tag (%(name)s)"
231+ u". Expected end of file." ),
232+ "expected-eof-but-got-end-tag" :
233+ _ (u"Unexpected end tag (%(name)s)"
234+ u". Expected end of file." ),
235+ }
236+
12237contentModelFlags = {
13238 "PCDATA" :0 ,
14239 "RCDATA" :1 ,
8131038 "windows-1258" ,
8141039 "tis-620" ,
8151040 "hz-gb-2312" ,
816- ))
1041+ ))
0 commit comments