summaryrefslogtreecommitdiff
path: root/mammoth/conversion.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-05-02 11:51:20 +0100
committerMichael Williamson <mike@zwobble.org>2016-05-02 11:51:20 +0100
commitc294898f2d1a35205debd453ccc30f903fc935b3 (patch)
tree4c3195cbe65f03d7c3a257473bf6d2676bb8ac99 /mammoth/conversion.py
parenta0155bb9c522b9b008ad3933ffcb9609b0f698e7 (diff)
Add support for table cells spanning multiple columns
Diffstat (limited to 'mammoth/conversion.py')
-rw-r--r--mammoth/conversion.py6
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)
]