]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport 1.33:
authorAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:05:09 +0000 (06:05 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Wed, 5 Dec 2001 06:05:09 +0000 (06:05 +0000)
Be more permissive in what is accepted as an attribute name; this makes
this module slightly more resiliant in the face of XHTML input, or just
colons in attribute names.

Lib/sgmllib.py

index f612f2e900d9141a1fb9f4e51ffd550ba2ada82d..194290236d53331cabd023cf4aafe0956c8bd936 100644 (file)
@@ -36,7 +36,7 @@ commentopen = re.compile('<!--')
 commentclose = re.compile(r'--\s*>')
 tagfind = re.compile('[a-zA-Z][-_.a-zA-Z0-9]*')
 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./:;+*%?!&$\(\)_#=~\'"]*))?')
 
 declname = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*')