diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-08-30 12:02:49 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-08-30 12:02:49 +0100 |
| commit | f4df40207f5ff873ac4f2e155373e7a10ee0ddca (patch) | |
| tree | a2923addccd51977727745026ea3a4f5969a18cd /mammoth/docx/__init__.py | |
| parent | cc671a920c1ce5886fcc6629965000bfc469fea1 (diff) | |
Support footnotes
Diffstat (limited to 'mammoth/docx/__init__.py')
| -rw-r--r-- | mammoth/docx/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mammoth/docx/__init__.py b/mammoth/docx/__init__.py index df3071d..2c3e780 100644 --- a/mammoth/docx/__init__.py +++ b/mammoth/docx/__init__.py @@ -7,6 +7,7 @@ from .content_types_xml import read_content_types_xml_element from .relationships_xml import read_relationships_xml_element from .numbering_xml import read_numbering_xml_element, Numbering from .styles_xml import read_styles_xml_element +from .footnotes_xml import read_footnotes_xml_element _namespaces = [ @@ -37,6 +38,12 @@ def read(fileobj): with _open_entry(zip_file, "word/styles.xml") as styles_fileobj: styles = read_styles_xml_element(_parse_docx_xml(styles_fileobj)) + if _has_entry(zip_file, "word/footnotes.xml"): + with _open_entry(zip_file, "word/footnotes.xml") as footnotes_fileobj: + footnote_elements = read_footnotes_xml_element(_parse_docx_xml(footnotes_fileobj)) + else: + footnote_elements = [] + with _open_entry(zip_file, "word/document.xml") as document_fileobj: document_xml = _parse_docx_xml(document_fileobj) return read_document_xml_element( @@ -46,6 +53,7 @@ def read(fileobj): docx_file=zip_file, numbering=numbering, styles=styles, + footnote_elements=footnote_elements, ) |
