From 0846955dd7d7967a0cd36ecf3e4714a14ed649f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Sun, 29 Dec 2019 16:23:55 +0100 Subject: [PATCH] Fixed issue with self-closing tags. Fix #125 --- readability/readability.py | 2 +- tests/test_article_only.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/readability/readability.py b/readability/readability.py index d7caa5b..645a7a9 100755 --- a/readability/readability.py +++ b/readability/readability.py @@ -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): """ diff --git a/tests/test_article_only.py b/tests/test_article_only.py index f6595d9..120aee2 100644 --- a/tests/test_article_only.py +++ b/tests/test_article_only.py @@ -106,3 +106,8 @@ class TestArticleOnly(unittest.TestCase): s = doc.summary() assert 'foo' in s + + def test_not_self_closing(self): + sample = '

foobar

' + doc = Document(sample) + assert '

foobar

' == doc.summary()