diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-08-30 11:27:51 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-08-30 11:27:51 +0100 |
| commit | 6ec6e3b4bb8b12ada9609af0bf0e6cd3775fdcef (patch) | |
| tree | 5169420479172025ee3d9f06a99626d1d3bce133 /mammoth | |
| parent | ce5a4bef9f49f37b934c32da45031d9be4f0f67b (diff) | |
Read footnote references
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/documents.py | 2 | ||||
| -rw-r--r-- | mammoth/docx/document_xml.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/mammoth/documents.py b/mammoth/documents.py index ed98aaa..49b2396 100644 --- a/mammoth/documents.py +++ b/mammoth/documents.py @@ -71,3 +71,5 @@ class Footnotes(object): return not (self == other) footnotes = Footnotes + +footnote_reference = FootnoteReference = dodge.data_class("FootnoteReference", ["footnote_id"]) diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py index 68b4bb3..e909a86 100644 --- a/mammoth/docx/document_xml.py +++ b/mammoth/docx/document_xml.py @@ -141,7 +141,7 @@ def _create_reader(numbering, content_types, relationships, styles, footnote_ele def _read_footnote(element): return _read_xml_elements(element.body).map( lambda body: documents.footnote(element.id, body)) - + @handler("w:tab") def tab(element): @@ -221,6 +221,10 @@ def _create_reader(numbering, content_types, relationships, styles, footnote_ele image = documents.image(alt_text=alt_text, content_type=content_type, open=open_image) return results.success(image) + @handler("w:footnoteReference") + def footnote_reference(element): + return results.success(documents.footnote_reference(element.attributes["w:id"])) + def read(element): handler = _handlers.get(element.name) if handler is None: |
