Commit 6fbd157e authored by Fred Drake's avatar Fred Drake

Quick fix for Python 2.x dependency.

parent 10d96c08
...@@ -66,6 +66,10 @@ class HTMLParseError(Exception): ...@@ -66,6 +66,10 @@ class HTMLParseError(Exception):
return result return result
def _contains_at(s, sub, pos):
return s[pos:pos+len(sub)] == sub
class HTMLParser(markupbase.ParserBase): class HTMLParser(markupbase.ParserBase):
"""Find tags and other markup and call handler functions. """Find tags and other markup and call handler functions.
...@@ -152,11 +156,11 @@ class HTMLParser(markupbase.ParserBase): ...@@ -152,11 +156,11 @@ class HTMLParser(markupbase.ParserBase):
k = self.parse_endtag(i) k = self.parse_endtag(i)
if k >= 0: if k >= 0:
self.clear_cdata_mode() self.clear_cdata_mode()
elif rawdata.startswith("<!--", i): # <!-- elif _contains_at(rawdata, "<!--", i): # <!--
k = self.parse_comment(i) k = self.parse_comment(i)
elif rawdata.startswith("<?", i): # <? elif _contains_at(rawdata, "<?", i): # <?
k = self.parse_pi(i) k = self.parse_pi(i)
elif rawdata.startswith("<!", i): # <! elif _contains_at(rawdata, "<?", i): # <!
k = self.parse_declaration(i) k = self.parse_declaration(i)
elif (i + 1) < n: elif (i + 1) < n:
self.handle_data("<") self.handle_data("<")
......
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