Skip to content

Commit 541e84e

Browse files
committed
add a parse error to processEOF in head and fix a testcase and fix two other parse error messages
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40485
1 parent d714b17 commit 541e84e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/html5parser.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ def __init__(self, parser, tree):
231231
def processEOF(self):
232232
self.tree.generateImpliedEndTags()
233233
if len(self.tree.openElements) > 2:
234-
self.parser.parseError(_("Unexpected end of file. Missing closing "
235-
"tags"))
234+
self.parser.parseError(_("Unexpected end of file. "
235+
u"Missing closing tags."))
236236
elif len(self.tree.openElements) == 2 and\
237237
self.tree.openElements[1].name != "body":
238238
# This happens for framesets or something?
@@ -418,6 +418,8 @@ def appendToHead(self, element):
418418
# the real thing
419419
def processEOF(self):
420420
if self.tree.openElements[-1].name in ("title", "style", "script"):
421+
self.parser.parseError(_(u"Unexpected end of file. "
422+
u"Expected end tag (" + self.tree.openElements[-1].name + ")."))
421423
self.tree.openElements.pop()
422424
self.anythingElse()
423425
self.parser.phase.processEOF()
@@ -700,8 +702,8 @@ def startTagHeading(self, name, attributes):
700702
def startTagA(self, name, attributes):
701703
afeAElement = self.tree.elementInActiveFormattingElements("a")
702704
if afeAElement:
703-
self.parser.parseError(_(u"Start tag a was in the list of active "
704-
"formatting elements."))
705+
self.parser.parseError(_(u"Unexpected start tag (a) implies "
706+
"end tag (a)."))
705707
self.endTagFormatting("a")
706708
if afeAElement in self.tree.openElements:
707709
self.tree.openElements.remove(afeAElement)

0 commit comments

Comments
 (0)