summaryrefslogtreecommitdiffstats
path: root/Lib/HTMLParser.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-02-13 18:36:55 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-02-13 18:36:55 (GMT)
commit369cbd744ed06b3e01fe7a2e6a86ea4d85250231 (patch)
tree3cd0eacf3c320dcc5ec695529b2f68ebbf041268 /Lib/HTMLParser.py
parentef18737b7f920bc9e8f406cfb71730b9f07c13f5 (diff)
downloadcpython-369cbd744ed06b3e01fe7a2e6a86ea4d85250231.zip
cpython-369cbd744ed06b3e01fe7a2e6a86ea4d85250231.tar.gz
cpython-369cbd744ed06b3e01fe7a2e6a86ea4d85250231.tar.bz2
Fix an index, add more tests, avoid raising errors for unknown declarations, and clean up comments.
Diffstat (limited to 'Lib/HTMLParser.py')
-rw-r--r--Lib/HTMLParser.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py
index 6cc9ff1..f230c5f 100644
--- a/Lib/HTMLParser.py
+++ b/Lib/HTMLParser.py
@@ -229,12 +229,13 @@ class HTMLParser(markupbase.ParserBase):
if rawdata[i:i+2] != '<!':
self.error('unexpected call to parse_html_declaration()')
if rawdata[i:i+4] == '<!--':
+ # this case is actually already handled in goahead()
return self.parse_comment(i)
elif rawdata[i:i+3] == '<![':
return self.parse_marked_section(i)
elif rawdata[i:i+9].lower() == '<!doctype':
# find the closing >
- gtpos = rawdata.find('>', 9)
+ gtpos = rawdata.find('>', i+9)
if gtpos == -1:
return -1
self.handle_decl(rawdata[i+2:gtpos])
@@ -427,7 +428,7 @@ class HTMLParser(markupbase.ParserBase):
pass
def unknown_decl(self, data):
- self.error("unknown declaration: %r" % (data,))
+ pass
# Internal -- helper to remove special character quoting
entitydefs = None