aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-11 20:27:25 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-11 20:27:25 +0000
commit519dfddb18eea15c26d0d8d8da68e1cebd865c39 (patch)
treefbe04f78b24c604463191a3f497eab403e73edda /mammoth
parent7ba9cc0ecdca695fec3cb90c98dd383e0edb2ba9 (diff)
Read bookmarks
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/documents.py2
-rw-r--r--mammoth/docx/document_xml.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/mammoth/documents.py b/mammoth/documents.py
index 9028b03..0e96c05 100644
--- a/mammoth/documents.py
+++ b/mammoth/documents.py
@@ -58,6 +58,8 @@ image = Image
def hyperlink(children, href=None, anchor=None):
return Hyperlink(href, anchor, children)
+
+bookmark = Bookmark = dodge.data_class("Bookmark", ["name"])
table = Table
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 56298f3..8bfdd6f 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -186,6 +186,15 @@ def _create_reader(numbering, content_types, relationships, styles, note_element
else:
return children_result
+ @handler("w:bookmarkStart")
+ def bookmark_start(element):
+ name = element.attributes.get("w:name")
+ if name == "_GoBack":
+ return results.success(None)
+ else:
+ return results.success(documents.bookmark(name))
+
+
@handler("w:br")
def br(element):
break_type = element.attributes.get("w:type")