From bfc8fea1e0c46bc0a337237c32b8c1a32985c144 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 24 Sep 2001 20:10:28 +0000 Subject: Re-factor the HTMLParser class to use the new markupbase.ParserBase class. Use a new internal method, error(), consistently to raise parse errors; the new base class also uses this. --- Lib/HTMLParser.py | 324 ++++-------------------------------------------------- 1 file changed, 19 insertions(+), 305 deletions(-) (limited to 'Lib/HTMLParser.py') diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py index f54e3d6196b..08c53b3ff22 100644 --- a/Lib/HTMLParser.py +++ b/Lib/HTMLParser.py @@ -8,6 +8,7 @@ # and CDATA (character data -- only end tags are special). +import markupbase import re import string @@ -21,12 +22,8 @@ entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]') starttagopen = re.compile('<[a-zA-Z]') -piopen = re.compile(r'<\?') piclose = re.compile('>') endtagopen = re.compile(']*>') -commentopen = re.compile('