0

Pandoc 是将文件从一种格式转换为另一种格式的绝佳工具。在它提供的所有不同功能中,一个有趣的功能是生成自包含的可移植 HTML 文件。当您想与同事共享 HTML 文件时,此功能非常有用。但是,当链接包含完整路径文件时。例如,html 文件 original.html 包含以下 HTML 项:

    <a href="file:///media/distribution/file_num.png" target="_blank" />
<img src="file:///media/distribution/file_num.png" /></a>

当我pandoc original.html --self-contained -o transformed.html用来生成可移植的 HTML 文件时,会给出以下错误消息:

pandoc: Could not fetch file:///media/distribution/file_num.png

InvalidUrlException"file:///media/distribution/file_num.png" "Invalid scheme". 

有任何想法吗?谢谢。

编辑: 我也尝试使用 pypandoc,

output=pypandoc.convert_file('data.html','html',outputfile="ddd.html",extra_args=['--self-contained'])

但同样的错误发生:

'Pandoc died with exitcode "%s" during conversion: %s' % (p.returncode, stderr)
RuntimeError: Pandoc died with exitcode "61" during conversion:
4

0 回答 0