|
|
@ -1,11 +1,11 @@
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def html_to_word_pandoc(html_file, output_file):
|
|
|
|
def html_to_word_pandoc(html_file, output_file):
|
|
|
|
subprocess.run(['pandoc', html_file, '-o', output_file])
|
|
|
|
subprocess.run(['pandoc', html_file, '-o', output_file])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# docx 转 markdown
|
|
|
|
def docx_to_markdown_pandoc(docx_file, output_file):
|
|
|
|
def docx_to_markdown_pandoc(docx_file, output_file):
|
|
|
|
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', output_file])
|
|
|
|
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', output_file])
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +28,8 @@ with open(finalFile, 'w', encoding='utf-8') as f1:
|
|
|
|
f1.write("【MathType" + str(idx) + "】\n")
|
|
|
|
f1.write("【MathType" + str(idx) + "】\n")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
f1.write(line.strip() + "\n")
|
|
|
|
f1.write(line.strip() + "\n")
|
|
|
|
|
|
|
|
# 删除临时文件 output_file
|
|
|
|
|
|
|
|
os.remove(output_file)
|
|
|
|
|
|
|
|
|
|
|
|
# 输出finalFile
|
|
|
|
# 输出finalFile
|
|
|
|
with open(finalFile, 'r', encoding='utf-8') as f:
|
|
|
|
with open(finalFile, 'r', encoding='utf-8') as f:
|
|
|
|