aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-01 13:28:57 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-01 13:28:57 +0000
commit4a35a848117c4fe646d36419096d099030878469 (patch)
tree9c83c8b8c0aee665311839477163776250db4b85 /mammoth
parent8fc128a3e70465b82605b4c0bdb3d1a6ffe87ef6 (diff)
Add style_name to Run
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/documents.py14
-rw-r--r--mammoth/docx/document_xml.py2
2 files changed, 11 insertions, 5 deletions
diff --git a/mammoth/documents.py b/mammoth/documents.py
index 08e3bba..215df8e 100644
--- a/mammoth/documents.py
+++ b/mammoth/documents.py
@@ -1,11 +1,17 @@
import collections
+Document = collections.namedtuple("Document", ["children"])
+Paragraph = collections.namedtuple("Paragraph", ["children", "style_name", "numbering"])
+Run = collections.namedtuple("Run", ["children", "style_name"])
+Text = collections.namedtuple("Text", ["value"])
+
+
+document = Document
def paragraph(children, style_name=None, numbering=None):
return Paragraph(children, style_name, numbering)
+def run(children, style_name=None):
+ return Run(children, style_name)
-Document = collections.namedtuple("Document", ["children"])
-Paragraph = collections.namedtuple("Paragraph", ["children", "style_name", "numbering"])
-Run = collections.namedtuple("Run", ["children"])
-Text = collections.namedtuple("Text", ["value"])
+text = Text
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 425ba37..403f880 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -22,7 +22,7 @@ def _create_reader(numbering):
@handler("w:r")
def run(element):
- return documents.Run(_read_xml_elements(element.children))
+ return documents.run(_read_xml_elements(element.children))
@handler("w:p")