Skip to content

Commit

Permalink
Fixed issue with self-closing tags. Fix buriy#125
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Dec 29, 2019
1 parent de20908 commit 0846955
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readability/readability.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_clean_html(self):
An internal method, which can be overridden in subclasses, for example,
to disable or to improve DOM-to-text conversion in .summary() method
"""
return clean_attributes(tounicode(self.html))
return clean_attributes(tounicode(self.html, method='html'))

def summary(self, html_partial=False):
"""
Expand Down
5 changes: 5 additions & 0 deletions tests/test_article_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,8 @@ def test_many_repeated_spaces(self):
s = doc.summary()

assert 'foo' in s

def test_not_self_closing(self):
sample = '<h2><a href="#"></a>foobar</h2>'
doc = Document(sample)
assert '<body id="readabilityBody"><h2><a href="#"></a>foobar</h2></body>' == doc.summary()

0 comments on commit 0846955

Please sign in to comment.