aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 12:46:36 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 12:46:36 +0100
commit1f9547fc3e26e8d1407b696dedc69aa402b7311c (patch)
treea108bcff8ab579985816b222beae873eda0499a8 /mammoth
parent7926658c69ab7dea2b7bbe7f9d79ac464f7bdedf (diff)
Test that comments are ignored by default
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/documents.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/mammoth/documents.py b/mammoth/documents.py
index 5d9830e..2767f86 100644
--- a/mammoth/documents.py
+++ b/mammoth/documents.py
@@ -12,6 +12,7 @@ class HasChildren(Element):
@cobble.data
class Document(HasChildren):
notes = cobble.field()
+ comments = cobble.field()
@cobble.data
class Paragraph(HasChildren):
@@ -68,10 +69,12 @@ class Image(Element):
self.open = open
-def document(children, notes=None):
+def document(children, notes=None, comments=None):
if notes is None:
notes = Notes({})
- return Document(children, notes)
+ if comments is None:
+ comments = []
+ return Document(children, notes, comments=comments)
def paragraph(children, style_id=None, style_name=None, numbering=None):
return Paragraph(children, style_id, style_name, numbering)
@@ -180,7 +183,13 @@ class Comment(object):
author_name = cobble.field()
author_initials = cobble.field()
-comment = Comment
+def comment(comment_id, body, author_name=None, author_initials=None):
+ return Comment(
+ comment_id=comment_id,
+ body=body,
+ author_name=author_name,
+ author_initials=author_initials,
+ )
@cobble.data
class CommentReference(Element):