Open hiei17 opened 5 years ago
which quotation marks are to be changed?
here is the modified code. Note that there are two changes.
The first is "-V CJKmainfont=STSong", due to my system is windows. The second is "cmd = "pandoc \"{}\" -o \"{}\" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)", change the '{}' to \"{}\" and delete the template order(because I don't care about the layout problem).
And I add a few debug code, neglect it. Also there are chinese annotations, I don't want to translate, neglect it again.
`from pathlib import Path import os
work_dir = Path.cwd()
export_pdf_dir = work_dir / 'pdf' if not export_pdf_dir.exists(): export_pdf_dir.mkdir()
for md_file in list(work_dir.glob('*.md')): md_file_name = md_file.name pdf_file_name = md_file_name.replace('.md', '.pdf') pdf_file = export_pdf_dir / pdf_file_name
cmd = "pandoc\ \"{}\\" -o\\"{}\\" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)
result = os.system(cmd)
# 测试是否成功
if result != 0:
print(f"fail!!")
else:
print(f"success!!")`
Are you using Windows ? I have the same issue. Change ' to " fix the issue for me