aboutsummaryrefslogtreecommitdiff
path: root/mammoth/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'mammoth/__init__.py')
-rw-r--r--mammoth/__init__.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/mammoth/__init__.py b/mammoth/__init__.py
index 27cc580..e8d3a83 100644
--- a/mammoth/__init__.py
+++ b/mammoth/__init__.py
@@ -16,15 +16,28 @@ def convert_to_markdown(*args, **kwargs):
return convert(*args, output_format="markdown", **kwargs)
-def convert(fileobj, transform_document=None, id_prefix=None, include_embedded_style_map=_undefined, **kwargs):
+def convert(
+ fileobj,
+ transform_document=None,
+ id_prefix=None,
+ include_embedded_style_map=_undefined,
+ external_file_access=_undefined,
+ **kwargs
+):
if include_embedded_style_map is _undefined:
include_embedded_style_map = True
+
if transform_document is None:
transform_document = lambda x: x
+
if include_embedded_style_map:
kwargs["embedded_style_map"] = read_style_map(fileobj)
+
+ if external_file_access is _undefined:
+ external_file_access = True
+
return options.read_options(kwargs).bind(lambda convert_options:
- docx.read(fileobj).map(transform_document).bind(lambda document:
+ docx.read(fileobj, external_file_access=external_file_access).map(transform_document).bind(lambda document:
conversion.convert_document_element_to_html(
document,
id_prefix=id_prefix,
@@ -32,7 +45,7 @@ def convert(fileobj, transform_document=None, id_prefix=None, include_embedded_s
)
)
)
-
+
def extract_raw_text(fileobj):
return docx.read(fileobj).map(extract_raw_text_from_element)