Commit bdda1454 authored by Guido van Rossum's avatar Guido van Rossum

Fix the test for properly closed endtags.

parent b173d902
...@@ -35,6 +35,7 @@ attrfind = re.compile( ...@@ -35,6 +35,7 @@ attrfind = re.compile(
locatestarttagend = re.compile("('[^']*'|\"[^\"]*\"|[^'\">]+)*/?>") locatestarttagend = re.compile("('[^']*'|\"[^\"]*\"|[^'\">]+)*/?>")
endstarttag = re.compile(r"\s*/?>") endstarttag = re.compile(r"\s*/?>")
endendtag = re.compile('>') endendtag = re.compile('>')
endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
declname = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*') declname = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*')
declstringlit = re.compile(r'(\'[^\']*\'|"[^"]*")\s*') declstringlit = re.compile(r'(\'[^\']*\'|"[^"]*")\s*')
...@@ -309,9 +310,11 @@ class HTMLParser: ...@@ -309,9 +310,11 @@ class HTMLParser:
if not match: if not match:
return -1 return -1
j = match.end() j = match.end()
tag = string.lower(string.strip(rawdata[i+2:j-1])) match = endtagfind.match(rawdata, i) # </ + tag + >
if not tag: if not match:
raise HTMLParseError("empty start tag", self.getpos()) raise HTMLParseError("bad end tag: %s" % `rawdata[i:j]`,
self.getpos())
tag = match.group(1)
self.handle_endtag(tag) self.handle_endtag(tag)
return j return j
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment