main
HuangHai 2 weeks ago
parent dc7189af7a
commit ee14e73411

@ -7,7 +7,8 @@ async def main():
# 要处理的文件路径
file_path = "Docx/《动能定理》巩固练习.docx"
# 转换docx为md
get_docx_content_by_pandoc(file_path, '../Word转试题.md',extract_media='../static/Images/')
get_docx_content_by_pandoc(file_path, '../Word转试题.md', parent_dir=True)
if __name__ == "__main__":
asyncio.run(main())

@ -3,7 +3,7 @@ import subprocess
import uuid
def get_docx_content_by_pandoc(docx_file, output_file=None, extract_media=None):
def get_docx_content_by_pandoc(docx_file, output_file=None, parent_dir=None):
# 最后拼接的内容
content = ""
# output_file 设置为临时目录下的uuid.md
@ -11,10 +11,16 @@ def get_docx_content_by_pandoc(docx_file, output_file=None, extract_media=None):
# 将docx_file去掉扩展名
prefix = docx_file.split(".")[0].split("/")[-1]
temp_markdown = os.path.join('./static/markdown/', prefix + '.md')
if parent_dir:
temp_markdown = os.path.join('../static/markdown/', prefix + '.md')
# 调用pandoc将docx文件转换成markdown
if extract_media is None:
if parent_dir is None:
os.mkdir("./static/Images/" + file_name)
extract_media = "./static/Images/"
else:
os.mkdir("../static/Images/" + file_name)
extract_media = "../static/Images/"
subprocess.run(['pandoc', docx_file, '-f', 'docx', '-t', 'markdown', '-o', temp_markdown,
'--extract-media=' + extract_media + file_name])
# 读取然后修改内容,输出到新的文件

@ -1,6 +1,6 @@
【题型】不定项选择
【题文】如图所示,固定斜面倾角为*θ*,整个斜面分为*AB*、*BC*两段,*AB*2*BC*.小物块*P*(可视为质点)与*AB*、*BC*两段斜面间的动摩擦因数分别为*μ*~1~、*μ*~2~.已知*P*由静止开始从*A*点释放,恰好能滑动到*C*点而停下,那么*θ*、*μ*~1~、*μ*~2~间应满足的关系是(  )
![5-40.tif](./static/Images/6855d84768e44d74ad95dfb7033bcf40/media/image1.png){width="0.9847222222222223in"
![5-40.tif](../static/Images/3a5fa82d1a614209a8b81f9321b21808/media/image1.png){width="0.9847222222222223in"
height="0.6979166666666666in"}A$tan\theta\text{}\frac{\mu_{1} + 2\mu_{2}}{3}$
B$tan\theta\text{}\frac{2\mu_{1} + \mu_{2}}{3}$
C$tan\theta\text{}2\mu_{1} - \mu_{2}$

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Loading…
Cancel
Save