diff --git a/__init__.py b/__init__.py new file mode 100644 index 00000000..769c3cc7 --- /dev/null +++ b/__init__.py @@ -0,0 +1,2 @@ +#Allow importing + diff --git a/pywb/__init__.py b/pywb/__init__.py index 769c3cc7..1cdc4fe6 100644 --- a/pywb/__init__.py +++ b/pywb/__init__.py @@ -1,2 +1,3 @@ #Allow importing + diff --git a/pywb/html_rewriter.py b/pywb/html_rewriter.py index 82113bfe..800f5dda 100644 --- a/pywb/html_rewriter.py +++ b/pywb/html_rewriter.py @@ -28,6 +28,9 @@ class WBHtml(HTMLParser): >>> parse('') + >>> parse('›   >') + ›   > + # Don't rewrite anchors >>> parse('Text') Text @@ -215,7 +218,7 @@ class WBHtml(HTMLParser): if rwMod is not None: attrValue = self._rewriteURL(attrValue, rwMod) - if attrValue: + if attrValue is not None: #self.out.write(' {0}="{1}"'.format(attrName, attrValue)) self.out.write(' ' + attrName + '="' + attrValue + '"') else: @@ -280,10 +283,10 @@ class WBHtml(HTMLParser): self.parseData(data) def handle_entityref(self, data): - self.out.write('&' + data) + self.out.write('&' + data + ';') def handle_charref(self, data): - self.out.write('&#' + data) + self.out.write('&#' + data + ';') def handle_comment(self, data): self.out.write('