diff options
author | Raymond Hettinger <python@rcn.com> | 2012-04-23 00:22:48 -0700 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2012-04-23 00:22:48 -0700 |
commit | 016878aea6fb1904b8a04c7f56223c90cd8a0522 (patch) | |
tree | 9a26efef0ab8adaf26e07774f5332401ccef658f /Lib/HTMLParser.py | |
parent | 094c33f0472a3f9c0aed621a736d24760a5c4d60 (diff) | |
parent | ea17082c25a4835975537373454097b8dd054692 (diff) | |
download | cpython-git-016878aea6fb1904b8a04c7f56223c90cd8a0522.tar.gz |
merge
Diffstat (limited to 'Lib/HTMLParser.py')
-rw-r--r-- | Lib/HTMLParser.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/HTMLParser.py b/Lib/HTMLParser.py index d4e14d4387..b336a4c31d 100644 --- a/Lib/HTMLParser.py +++ b/Lib/HTMLParser.py @@ -22,13 +22,13 @@ charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]') starttagopen = re.compile('<[a-zA-Z]') piclose = re.compile('>') commentclose = re.compile(r'--\s*>') -tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9:_]*') +tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*') # see http://www.w3.org/TR/html5/tokenization.html#tag-open-state # and http://www.w3.org/TR/html5/tokenization.html#tag-name-state tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*') attrfind = re.compile( - r'[\s/]*((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*' + r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*' r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*') locatestarttagend = re.compile(r""" @@ -289,7 +289,7 @@ class HTMLParser(markupbase.ParserBase): match = tagfind.match(rawdata, i+1) assert match, 'unexpected call to parse_starttag()' k = match.end() - self.lasttag = tag = rawdata[i+1:k].lower() + self.lasttag = tag = match.group(1).lower() while k < endpos: m = attrfind.match(rawdata, k) |