main
HuangHai 2 weeks ago
parent 08acc20ff4
commit 511b79cde3

@ -2,7 +2,7 @@ from Util.DocxUtil import *
if __name__ == '__main__':
# docx文件路径
docx_file = '../static/Txt/化学方程式_CHEMISTRY_1.docx'
docx_file = 'static/Txt/化学方程式_CHEMISTRY_1.docx'
# 整合最终的拼接完的文本
content = get_docx_content_by_pandoc(docx_file)

@ -30,11 +30,11 @@ def get_docx_content_by_pandoc(docx_file):
content = ""
# output_file 设置为临时目录下的uuid.md
file_name = uuid.uuid4().hex
temp_markdown = os.path.join('../static/markdown/', file_name + '.md')
temp_markdown = os.path.join('./static/markdown/', file_name + '.md')
# 调用pandoc将docx文件转换成markdown
os.mkdir("../static/Images/" + file_name)
os.mkdir("./static/Images/" + file_name)
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', temp_markdown,
'--extract-media=../static/Images/' + file_name])
'--extract-media=./static/Images/' + file_name])
# 读取然后修改内容,输出到新的文件
wmf_idx = 0 # wmf索引
img_idx = 0 # 图片索引

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save