diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-05-02 11:51:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-05-02 11:51:20 +0100 |
| commit | c294898f2d1a35205debd453ccc30f903fc935b3 (patch) | |
| tree | 4c3195cbe65f03d7c3a257473bf6d2676bb8ac99 /mammoth/conversion.py | |
| parent | a0155bb9c522b9b008ad3933ffcb9609b0f698e7 (diff) | |
Add support for table cells spanning multiple columns
Diffstat (limited to 'mammoth/conversion.py')
| -rw-r--r-- | mammoth/conversion.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py index a2d1d0d..ce4ee21 100644 --- a/mammoth/conversion.py +++ b/mammoth/conversion.py @@ -153,9 +153,13 @@ class _DocumentConverter(documents.ElementVisitor): def visit_table_cell(self, table_cell): + if table_cell.colspan == 1: + attributes = {} + else: + attributes = {"colspan": str(table_cell.colspan)} nodes = [html.force_write] + self._visit_all(table_cell.children) return [ - html.element("td", {}, nodes) + html.element("td", attributes, nodes) ] |
