From 24c6649d0946f2d7bb8157b75caec42b60a2f1e7 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 1 Dec 2013 13:39:03 +0000 Subject: Read tab elements --- mammoth/documents.py | 5 +++++ mammoth/docx/document_xml.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'mammoth') diff --git a/mammoth/documents.py b/mammoth/documents.py index d054eef..c8082d3 100644 --- a/mammoth/documents.py +++ b/mammoth/documents.py @@ -4,6 +4,8 @@ Document = collections.namedtuple("Document", ["children"]) Paragraph = collections.namedtuple("Paragraph", ["children", "style_name", "numbering"]) Run = collections.namedtuple("Run", ["children", "style_name", "is_bold", "is_italic"]) Text = collections.namedtuple("Text", ["value"]) +class Tab(object): + pass document = Document @@ -15,3 +17,6 @@ def run(children, style_name=None, is_bold=None, is_italic=None): return Run(children, style_name, bool(is_bold), bool(is_italic)) text = Text +_tab = Tab() +def tab(): + return _tab diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py index 4bfb8d1..59f9920 100644 --- a/mammoth/docx/document_xml.py +++ b/mammoth/docx/document_xml.py @@ -66,9 +66,13 @@ def _create_reader(numbering): @handler("w:document") def document(element): body_element = _find_child(element, "w:body") - return documents.Document(_read_xml_elements(body_element.children)) + return documents.document(_read_xml_elements(body_element.children)) + @handler("w:tab") + def tab(element): + return documents.tab() + def read(element): handler = _handlers.get(element.name) if handler is None: -- cgit v1.2.3