Skip to content

Commit

Permalink
fix newline bug
Browse files Browse the repository at this point in the history
  • Loading branch information
theSage21 committed Jun 22, 2021
1 parent 820b779 commit 88e0b49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions html2text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def feed(self, data: str) -> None:
super().feed(data)

def handle(self, data: str) -> str:
self.start = True
self.feed(data)
self.feed("")
markdown = self.optwrap(self.finish())
Expand Down
8 changes: 5 additions & 3 deletions test/test_newlines_on_multiple_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

def test_newline_on_multiple_calls():
h = html2text.HTML2Text()
md1 = h.handle("<p>test</test>")
md2 = h.handle("<p>test</test>")
assert md1 == md2
html = "<p>test</p>"
md1 = h.handle(html)
md2 = h.handle(html)
md3 = h.handle(html)
assert md1 == md2 == md3

0 comments on commit 88e0b49

Please sign in to comment.