aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/conversion.py3
-rw-r--r--mammoth/documents.py6
-rw-r--r--mammoth/docx/body_xml.py4
3 files changed, 13 insertions, 0 deletions
diff --git a/mammoth/conversion.py b/mammoth/conversion.py
index e05cccc..2262392 100644
--- a/mammoth/conversion.py
+++ b/mammoth/conversion.py
@@ -201,6 +201,9 @@ class _DocumentConverter(documents.ElementVisitor):
self._html_generator.append(note_generator)
self._html_generator.end()
+ def visit_comment_reference(self, reference):
+ return []
+
def _visit_all(self, elements):
return lists.flat_map(self.visit, elements)
diff --git a/mammoth/documents.py b/mammoth/documents.py
index 93b080c..5d9830e 100644
--- a/mammoth/documents.py
+++ b/mammoth/documents.py
@@ -182,4 +182,10 @@ class Comment(object):
comment = Comment
+@cobble.data
+class CommentReference(Element):
+ comment_id = cobble.field()
+
+comment_reference = CommentReference
+
ElementVisitor = cobble.visitor(Element)
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index c493c4b..fe75f7c 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -334,6 +334,9 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
return note_reference
+ def read_comment_reference(element):
+ return _success(documents.comment_reference(element.attributes["w:id"]))
+
def alternate_content(element):
return read_child_elements(element.find_child("mc:Fallback"))
@@ -364,6 +367,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
"v:imagedata": read_imagedata,
"w:footnoteReference": note_reference_reader("footnote"),
"w:endnoteReference": note_reference_reader("endnote"),
+ "w:commentReference": read_comment_reference,
"mc:AlternateContent": alternate_content,
"w:sdt": read_sdt
}