aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/__init__.py3
-rw-r--r--mammoth/docx/__init__.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/mammoth/__init__.py b/mammoth/__init__.py
index e70e8ca..b0ffa12 100644
--- a/mammoth/__init__.py
+++ b/mammoth/__init__.py
@@ -3,12 +3,13 @@ from . import docx, conversion, options, documents, images, underline
__all__ = ["convert_to_html", "extract_raw_text", "images", "underline"]
-def convert_to_html(fileobj, transform_document=None, **kwargs):
+def convert_to_html(fileobj, transform_document=None, generate_uniquifier=None, **kwargs):
if transform_document is None:
transform_document = lambda x: x
return docx.read(fileobj).map(transform_document).bind(lambda document:
conversion.convert_document_element_to_html(
document,
+ generate_uniquifier=generate_uniquifier,
**options.read_options(kwargs)
)
)
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,
)