Merge the indexfix and comments clean up.
This commit is contained in:
commit
5e4d908704
|
@ -270,12 +270,13 @@ class HTMLParser(_markupbase.ParserBase):
|
||||||
if rawdata[i:i+2] != '<!':
|
if rawdata[i:i+2] != '<!':
|
||||||
self.error('unexpected call to parse_html_declaration()')
|
self.error('unexpected call to parse_html_declaration()')
|
||||||
if rawdata[i:i+4] == '<!--':
|
if rawdata[i:i+4] == '<!--':
|
||||||
|
# this case is actually already handled in goahead()
|
||||||
return self.parse_comment(i)
|
return self.parse_comment(i)
|
||||||
elif rawdata[i:i+3] == '<![':
|
elif rawdata[i:i+3] == '<![':
|
||||||
return self.parse_marked_section(i)
|
return self.parse_marked_section(i)
|
||||||
elif rawdata[i:i+9].lower() == '<!doctype':
|
elif rawdata[i:i+9].lower() == '<!doctype':
|
||||||
# find the closing >
|
# find the closing >
|
||||||
gtpos = rawdata.find('>', 9)
|
gtpos = rawdata.find('>', i+9)
|
||||||
if gtpos == -1:
|
if gtpos == -1:
|
||||||
return -1
|
return -1
|
||||||
self.handle_decl(rawdata[i+2:gtpos])
|
self.handle_decl(rawdata[i+2:gtpos])
|
||||||
|
|
|
@ -393,7 +393,6 @@ class HTMLParserTolerantTestCase(HTMLParserStrictTestCase):
|
||||||
self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])
|
self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])
|
||||||
|
|
||||||
def test_illegal_declarations(self):
|
def test_illegal_declarations(self):
|
||||||
# XXX this might be wrong
|
|
||||||
self._run_check('<!spacer type="block" height="25">',
|
self._run_check('<!spacer type="block" height="25">',
|
||||||
[('comment', 'spacer type="block" height="25"')])
|
[('comment', 'spacer type="block" height="25"')])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue