Pandoc“--filter”选项不适用于 "comments.py" 脚本
Pandoc "--filter" option is not working with "comments.py" script
我正在尝试通过以下命令使用 'comments.py' 脚本(来自存储库 github.com/aaren/pandocfilters):
Pandoc -o myOutput.tex myInput.html --filter ./comments.py
但它不起作用。
Pandoc 总是转换标签 <!-- BEGIN COMMENT -->
和 <!-- END COMMENT -->
之间的文本并删除注释。
谁能帮我找出问题所在?
PS:我测试了 'caps.py' 脚本(来自同一个 repo)并且它工作正常,但是 'comments.py' 没有。
我需要忽略指定标签之间的文本。
这是我的 HTML 输入:
<i> normal text </i>
<!-- BEGIN COMMENT -->
<i> ignore this line </i>
<!-- END COMMENT -->
<b> normal text 2 </b>
这是我的 LaTeX 输出:
\emph{normal text}
\emph{ignore this line}
\textbf{normal text 2}
提前致谢!
过滤器不起作用的原因是当 Pandoc 读取 HTML 时,它不接受评论。另一方面,当 Pandoc 读取 Markdown 时,它会将评论存储在其 AST 中,如 RawBlock 'html'
.
所以你需要使用markdown输入的过滤器,比如:
normal text
<!-- BEGIN COMMENT -->
ignore this line
<!-- END COMMENT -->
normal text 2
pandoc -o myOutput.tex myInput.md --filter ./comments.py
或者只使用简单的 HTML 评论:
<i> normal text </i>
<!--
<i> ignore this line </i>
-->
<b> normal text 2 </b>
我正在尝试通过以下命令使用 'comments.py' 脚本(来自存储库 github.com/aaren/pandocfilters):
Pandoc -o myOutput.tex myInput.html --filter ./comments.py
但它不起作用。
Pandoc 总是转换标签 <!-- BEGIN COMMENT -->
和 <!-- END COMMENT -->
之间的文本并删除注释。
谁能帮我找出问题所在?
PS:我测试了 'caps.py' 脚本(来自同一个 repo)并且它工作正常,但是 'comments.py' 没有。
我需要忽略指定标签之间的文本。
这是我的 HTML 输入:
<i> normal text </i>
<!-- BEGIN COMMENT -->
<i> ignore this line </i>
<!-- END COMMENT -->
<b> normal text 2 </b>
这是我的 LaTeX 输出:
\emph{normal text}
\emph{ignore this line}
\textbf{normal text 2}
提前致谢!
过滤器不起作用的原因是当 Pandoc 读取 HTML 时,它不接受评论。另一方面,当 Pandoc 读取 Markdown 时,它会将评论存储在其 AST 中,如 RawBlock 'html'
.
所以你需要使用markdown输入的过滤器,比如:
normal text
<!-- BEGIN COMMENT -->
ignore this line
<!-- END COMMENT -->
normal text 2
pandoc -o myOutput.tex myInput.md --filter ./comments.py
或者只使用简单的 HTML 评论:
<i> normal text </i>
<!--
<i> ignore this line </i>
-->
<b> normal text 2 </b>