]> granicus.if.org Git - python/commitdiff
Allow recognition of attributes even if they don't have space in front
authorFred Drake <fdrake@acm.org>
Mon, 25 Jan 1999 21:57:07 +0000 (21:57 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 25 Jan 1999 21:57:07 +0000 (21:57 +0000)
of them.  I.e., '<a name="foo"href="bar.html">' will now have two
attributes recognized.

Based on comments from newgroup.

Lib/sgmllib.py

index ffb2ccc348121d88e72e42068558a51a1ebef69a..8d50a88afca5a11deace324f9fbd439b142a5d28 100644 (file)
@@ -35,7 +35,7 @@ commentopen = re.compile('<!--')
 commentclose = re.compile('--[%s]*>' % string.whitespace)
 tagfind = re.compile('[a-zA-Z][-.a-zA-Z0-9]*')
 attrfind = re.compile(
-    '[%s]+([a-zA-Z_][-.a-zA-Z_0-9]*)' % string.whitespace
+    '[%s]*([a-zA-Z_][-.a-zA-Z_0-9]*)' % string.whitespace
     + ('([%s]*=[%s]*' % (string.whitespace, string.whitespace))
     + r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:+*%?!\(\)_#=~]*))?')