main
HuangHai 2 weeks ago
parent 252fe44713
commit 08acc20ff4

@ -35,9 +35,6 @@ def get_docx_content_by_pandoc(docx_file):
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())
# 读取然后修改内容,输出到新的文件
wmf_idx = 0 # wmf索引
img_idx = 0 # 图片索引
@ -66,12 +63,10 @@ def get_docx_content_by_pandoc(docx_file):
pos = line.find(")")
q = line[:pos + 1]
img_idx += 1
# content += "【图片" + str(img_idx) + "】\n"
content += q + "\n"
else:
content += line.strip().replace("**", "") + "\n"
# 删除临时文件 output_file
# os.remove(temp_markdown)
# print("生成的md文件路径" + temp_markdown)
os.remove(temp_markdown)
return content

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save