Fixed issue with self-closing tags. Fix #125
This commit is contained in:
parent
de20908e57
commit
0846955dd7
@ -171,7 +171,7 @@ class Document:
|
||||
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):
|
||||
"""
|
||||
|
@ -106,3 +106,8 @@ class TestArticleOnly(unittest.TestCase):
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user