diff options
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/documents.py | 15 |
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): |
