aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/document_xml.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/docx/document_xml.py')
-rw-r--r--mammoth/docx/document_xml.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 9c895d4..fad4f87 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -96,12 +96,24 @@ def _create_reader(numbering, content_types, relationships, docx_file):
@handler("w:tab")
def tab(element):
return results.success(documents.tab())
-
+
+
@handler("w:ins")
def ins(element):
return _read_xml_elements(element.children)
+ @handler("w:hyperlink")
+ def hyperlink(element):
+ relationship_id = element.attributes.get("r:id")
+ children_result = _read_xml_elements(element.children)
+ if relationship_id is None:
+ return children_result
+ else:
+ href = relationships[relationship_id].target
+ return children_result.map(lambda children: documents.hyperlink(href, children))
+
+
@handler("w:drawing")
def drawing(element):
return _read_xml_elements(element.children)