nanoc:我如何将选项传递给pandoc-ruby?

car*_*cal 3 ruby nanoc pandoc

我正在尝试使用nanoc 3.5.0和使用的pandoc过滤器pandoc-ruby.具体来说,我无法从我的Rules文件中传递几个选项,以便最终调用PandocRuby.convert()如下所示:

PandocRuby.convert(content,
                   {:from => :markdown, :to => :html}, :no_wrap, 
                   :table_of_contents, :mathjax, :standalone,
                   {"template" => Dir.getwd + '/layouts/pandocTemplate.html'})
Run Code Online (Sandbox Code Playgroud)

当我将上述调用放在自定义过滤器中时,一切正常.但是,我想指定pandoc选项,Rules这样我就不必为每组选项创建一个特殊的过滤器.

默认的pandoc过滤器被定义为函数run(content, params={})并且只是调用PandocRuby.convert(content, params).如何设置params,使得PandocRuby.convert()被称为正确?以下指令Rules不起作用:

filter :pandoc, :params => { :from => :markdown, :to => :html, :no_wrap, :table_of_contents, :mathjax, :standalone, "template" => Dir.getwd + '/layouts/pandocTemplate.html' }
filter :pandoc, :params => { :from => :markdown, :to => :html, :no_wrap => true, :table_of_contents => true, :mathjax => true, :standalone => true, "template" => Dir.getwd + '/layouts/pandocTemplate.html' }
Run Code Online (Sandbox Code Playgroud)

第一个指令导致Ruby错误,第二个指令运行但是给我一个空白页面,表明pandoc没有被调用.我对Ruby并不熟悉,所以我目前的努力只是在黑暗中刺伤.

Den*_*yne 5

此时pandoc,nanoc附带的过滤器无法正常执行此操作.给过滤器的参数直接传递给PandocRuby.convert:

def run(content, params={})
  PandocRuby.convert(content, params)
end
Run Code Online (Sandbox Code Playgroud)

(来源)

您对过滤器的调用有两个以上的参数,这就是它崩溃的原因.过滤器肯定需要更新(我对如何调用它的想法太天真了).如果您想改进过滤器,我们欢迎您提交拉动请求!我在平均时间(链接)报告了这个问题.

(希望我能尽快给出正确的答案来更新这个答案!)