【发布时间】:2013-02-01 12:52:00
【问题描述】:
我正在尝试将 nanoc 3.5.0 与使用 pandoc-ruby 的 pandoc 过滤器一起使用。具体来说,我无法从我的Rules 文件中传递几个选项,因此对PandocRuby.convert() 的最终调用如下所示:
PandocRuby.convert(content,
{:from => :markdown, :to => :html}, :no_wrap,
:table_of_contents, :mathjax, :standalone,
{"template" => Dir.getwd + '/layouts/pandocTemplate.html'})
当我将上述调用放在自定义过滤器中时,一切正常。但是,我想在 Rules 中指定 pandoc 选项,这样我就不必为每组选项创建一个特殊的过滤器。
默认的 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' }
第一个指令导致 Ruby 错误,第二个指令运行但给了我一个空白页,表明 pandoc 没有被正确调用。我对 Ruby 不是很熟悉,所以我目前的努力只是在黑暗中摸索。
【问题讨论】: