mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Accept commas in unquoted attribute values.
This closes SF patch #669683.
This commit is contained in:
parent
080cb3268f
commit
0834d77bc4
4 changed files with 10 additions and 2 deletions
|
@ -26,7 +26,7 @@ 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:_]*')
|
||||||
attrfind = re.compile(
|
attrfind = re.compile(
|
||||||
r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
|
r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*'
|
||||||
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?')
|
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~]*))?')
|
||||||
|
|
||||||
locatestarttagend = re.compile(r"""
|
locatestarttagend = re.compile(r"""
|
||||||
<[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
|
<[a-zA-Z][-.a-zA-Z0-9:_]* # tag name
|
||||||
|
|
|
@ -34,7 +34,7 @@ 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]*')
|
||||||
attrfind = re.compile(
|
attrfind = re.compile(
|
||||||
r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*'
|
r'\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*'
|
||||||
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~\'"]*))?')
|
r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"]*))?')
|
||||||
|
|
||||||
|
|
||||||
class SGMLParseError(RuntimeError):
|
class SGMLParseError(RuntimeError):
|
||||||
|
|
|
@ -197,6 +197,10 @@ DOCTYPE html [
|
||||||
self._run_check("""<a b='' c="">""", [
|
self._run_check("""<a b='' c="">""", [
|
||||||
("starttag", "a", [("b", ""), ("c", "")]),
|
("starttag", "a", [("b", ""), ("c", "")]),
|
||||||
])
|
])
|
||||||
|
# Regression test for SF patch #669683.
|
||||||
|
self._run_check("<e a=rgb(1,2,3)>", [
|
||||||
|
("starttag", "e", [("a", "rgb(1,2,3)")]),
|
||||||
|
])
|
||||||
|
|
||||||
def test_attr_entity_replacement(self):
|
def test_attr_entity_replacement(self):
|
||||||
self._run_check("""<a b='&><"''>""", [
|
self._run_check("""<a b='&><"''>""", [
|
||||||
|
|
|
@ -200,6 +200,10 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
|
||||||
self.check_events("""<a b='' c="">""", [
|
self.check_events("""<a b='' c="">""", [
|
||||||
("starttag", "a", [("b", ""), ("c", "")]),
|
("starttag", "a", [("b", ""), ("c", "")]),
|
||||||
])
|
])
|
||||||
|
# Regression test for SF patch #669683.
|
||||||
|
self.check_events("<e a=rgb(1,2,3)>", [
|
||||||
|
("starttag", "e", [("a", "rgb(1,2,3)")]),
|
||||||
|
])
|
||||||
|
|
||||||
def test_attr_funky_names(self):
|
def test_attr_funky_names(self):
|
||||||
self.check_events("""<a a.b='v' c:d=v e-f=v>""", [
|
self.check_events("""<a a.b='v' c:d=v e-f=v>""", [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue