parent
d44c62d7ce
commit
dde0aff8bd
@ -27,19 +27,23 @@ def export_documents(
|
|||||||
doc_filename = conv_res.input.file.stem
|
doc_filename = conv_res.input.file.stem
|
||||||
|
|
||||||
# Export Deep Search document JSON format:
|
# Export Deep Search document JSON format:
|
||||||
with (output_dir / f"{doc_filename}.json").open("w") as fp:
|
with (output_dir / f"{doc_filename}.json").open(
|
||||||
|
"w", encoding="utf-8"
|
||||||
|
) as fp:
|
||||||
fp.write(json.dumps(conv_res.render_as_dict()))
|
fp.write(json.dumps(conv_res.render_as_dict()))
|
||||||
|
|
||||||
# Export Text format:
|
# Export Text format:
|
||||||
with (output_dir / f"{doc_filename}.txt").open("w") as fp:
|
with (output_dir / f"{doc_filename}.txt").open("w", encoding="utf-8") as fp:
|
||||||
fp.write(conv_res.render_as_text())
|
fp.write(conv_res.render_as_text())
|
||||||
|
|
||||||
# Export Markdown format:
|
# Export Markdown format:
|
||||||
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
with (output_dir / f"{doc_filename}.md").open("w", encoding="utf-8") as fp:
|
||||||
fp.write(conv_res.render_as_markdown())
|
fp.write(conv_res.render_as_markdown())
|
||||||
|
|
||||||
# Export Document Tags format:
|
# Export Document Tags format:
|
||||||
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
|
with (output_dir / f"{doc_filename}.doctags").open(
|
||||||
|
"w", encoding="utf-8"
|
||||||
|
) as fp:
|
||||||
fp.write(conv_res.render_as_doctags())
|
fp.write(conv_res.render_as_doctags())
|
||||||
|
|
||||||
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
|
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
|
||||||
|
@ -28,19 +28,23 @@ def export_documents(
|
|||||||
doc_filename = conv_res.input.file.stem
|
doc_filename = conv_res.input.file.stem
|
||||||
|
|
||||||
# Export Deep Search document JSON format:
|
# Export Deep Search document JSON format:
|
||||||
with (output_dir / f"{doc_filename}.json").open("w") as fp:
|
with (output_dir / f"{doc_filename}.json").open(
|
||||||
|
"w", encoding="utf-8"
|
||||||
|
) as fp:
|
||||||
fp.write(json.dumps(conv_res.render_as_dict()))
|
fp.write(json.dumps(conv_res.render_as_dict()))
|
||||||
|
|
||||||
# Export Text format:
|
# Export Text format:
|
||||||
with (output_dir / f"{doc_filename}.txt").open("w") as fp:
|
with (output_dir / f"{doc_filename}.txt").open("w", encoding="utf-8") as fp:
|
||||||
fp.write(conv_res.render_as_text())
|
fp.write(conv_res.render_as_text())
|
||||||
|
|
||||||
# Export Markdown format:
|
# Export Markdown format:
|
||||||
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
with (output_dir / f"{doc_filename}.md").open("w", encoding="utf-8") as fp:
|
||||||
fp.write(conv_res.render_as_markdown())
|
fp.write(conv_res.render_as_markdown())
|
||||||
|
|
||||||
# Export Document Tags format:
|
# Export Document Tags format:
|
||||||
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
|
with (output_dir / f"{doc_filename}.doctags").open(
|
||||||
|
"w", encoding="utf-8"
|
||||||
|
) as fp:
|
||||||
fp.write(conv_res.render_as_doctags())
|
fp.write(conv_res.render_as_doctags())
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user