main
HuangHai 2 weeks ago
parent 4e3bf3a727
commit 4ba35fd79e

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -29,9 +29,11 @@ def get_docx_content_by_pandoc(docx_file):
# 最后拼接的内容
content = ""
# output_file 设置为临时目录下的uuid.md
temp_markdown = os.path.join(os.environ['TEMP'], uuid.uuid4().hex + '.md')
file_name=uuid.uuid4().hex
temp_markdown = os.path.join(os.environ['TEMP'], file_name + '.md')
# 调用pandoc将docx文件转换成markdown
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', temp_markdown])
os.mkdir("../static/Images/"+file_name)
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', temp_markdown,'--extract-media=../static/Images/'+file_name])
# 打印 temp_markdown 文件
# with open(temp_markdown, 'r', encoding='utf-8') as f:
# print(f.read())

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save