From 7ba9cc0ecdca695fec3cb90c98dd383e0edb2ba9 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 11 Feb 2015 20:22:54 +0000 Subject: Read anchor from hyperlinks --- mammoth/documents.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mammoth/documents.py') diff --git a/mammoth/documents.py b/mammoth/documents.py index 1adcc0d..9028b03 100644 --- a/mammoth/documents.py +++ b/mammoth/documents.py @@ -8,7 +8,7 @@ Run = dodge.data_class("Run", [ "is_underline", "vertical_alignment", ]) Text = dodge.data_class("Text", ["value"]) -Hyperlink = dodge.data_class("Hyperlink", ["href", "children"]) +Hyperlink = dodge.data_class("Hyperlink", ["href", "anchor", "children"]) Table = dodge.data_class("Table", ["children"]) TableRow = dodge.data_class("TableRow", ["children"]) TableCell = dodge.data_class("TableCell", ["children"]) @@ -55,7 +55,11 @@ def tab(): image = Image -hyperlink = Hyperlink + +def hyperlink(children, href=None, anchor=None): + return Hyperlink(href, anchor, children) + + table = Table table_row = TableRow table_cell = TableCell -- cgit v1.2.3