Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The AUTHORS/Contributors are (and/or have been):
* Edward Ross <edward@skeptric.com>
* Mike Borsetti
* Gregory Anders <greg@gpanders.com>
* Maciej Podolski https://github.com/mpodolsk

Maintainer:

Expand Down
1 change: 1 addition & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ UNRELEASED
* Fix #344: indent ``<ul>`` inside ``<ol>`` three spaces instead of two to comply with CommonMark, GFM, etc.
* Fix #324: unnecessary spaces around ``<b>``, ``<em>``, and ``strike`` tags.
* Don't wrap tables by default and add a ``--wrap-tables`` config option
* Fix #320 padding empty tables and tables with no </tr> tags.

2020.1.16
=========
Expand Down
2 changes: 2 additions & 0 deletions html2text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ def link_url(self: HTML2Text, link: str, title: str = "") -> None:
self.o(" \n")
else:
if self.pad_tables:
# add break in case the table is empty or its 1 row table
self.soft_br()
self.o("</" + config.TABLE_MARKER_FOR_PAD + ">")
self.o(" \n")
if tag in ["td", "th"] and start:
Expand Down
1 change: 1 addition & 0 deletions test/pad_table_empty.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<table></table>
3 changes: 3 additions & 0 deletions test/pad_table_empty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| |


10 changes: 10 additions & 0 deletions test/pad_table_no_closed_tr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<table>
<tr>
<td><strong>xxx </strong></td>
<td><strong>xxx</strong></td>
<td>xxxx</td>
<tr>
<td><strong>xxxx </strong></td>
<td><strong>xxxx</strong></td>
<td>xxxx</td>
</table>
3 changes: 3 additions & 0 deletions test/pad_table_no_closed_tr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
| **xxx** | **xxx** | xxxx | **xxxx** | **xxxx** | xxxx |