diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 22:16:55 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-28 22:16:55 -0800 |
commit | 5cea66f5e271dc93285be2edd4e9d205ebcaf9b5 (patch) | |
tree | 55d1b6e25a9ad85219b35de9fa61d2fc4fac6e0b /test/normalize.py | |
parent | 37e2c4b2bf50d8da468dcac93f35567fe00700e6 (diff) |
Updated spec.txt and normalize.py.
Diffstat (limited to 'test/normalize.py')
-rw-r--r-- | test/normalize.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/normalize.py b/test/normalize.py index 6eb4ec2..6073bf0 100644 --- a/test/normalize.py +++ b/test/normalize.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from html.parser import HTMLParser +import urllib try: from html.parser import HTMLParseError @@ -61,7 +62,10 @@ class MyHTMLParser(HTMLParser): attrs.sort() for (k,v) in attrs: self.output += " " + k - if v != None: + if v in ['href','src']: + self.output += ("=" + '"' + + urllib.quote(urllib.unquote(v), safe='/') + '"') + elif v != None: self.output += ("=" + '"' + cgi.escape(v,quote=True) + '"') self.output += ">" self.last_tag = tag |