我可以使用以下命令编译发票:
pandoc details.yml -o output.pdf --template=invoice.tex --latex-engine=xelatex
但是当我用 Python 写同样的东西时,我收到一个关于输入格式的错误:
>>> pypandoc.convert_file('details.yml', 'pdf', outputfile='pyout.pdf', extra_args=['--latex-engine=xelatex', '--template=invoice.tex'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/pypandoc/__init__.py", line 140, in convert_file
outputfile=outputfile, filters=filters)
File "/usr/local/lib/python3.6/site-packages/pypandoc/__init__.py", line 262, in _convert_input
format, to = _validate_formats(format, to, outputfile)
File "/usr/local/lib/python3.6/site-packages/pypandoc/__init__.py", line 223, in _validate_formats
_get_base_format(format), ', '.join(from_formats)))
RuntimeError: Invalid input format! Got "yml" but expected one of
these: commonmark, docbook, docx, epub, haddock, html, json, latex, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, odt, opml, org, rst, t2t, textile, twiki
我在这里做错了什么?为什么 yml 不被接受?