我正在嘗試使用nanoc 3.5.0與使用pandoc-ruby
的pandoc
篩選器。具體地講,我無法從我的Rules
文件傳遞幾個選項,使得以PandocRuby.convert()
最後調用看起來是這樣的:nanoc:我如何將選項傳遞給pandoc-ruby?
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' }
第一指令導致紅寶石錯誤,第二個指令運行,但給了我一個空白頁,表明pandoc沒有得到所謂的權利。我對Ruby不太熟悉,所以我目前的努力只是在黑暗中刺探。
感謝您的快速響應!如果我理解了'pandoc-ruby'文檔,那麼第二個參數必須是'{:from => ...,:= => ...}'哈希值,其次是其他選項。我會嘗試更改當前的過濾器,但無法預測我是否成功。 – caracal