簡體   English   中英

有沒有辦法在 pandoc lua 過濾器中找出 output 格式

[英]Is there a way to figure out the output format in a pandoc lua filter

可以說我有這樣的代碼:

return {
  {
    Str = function (elem)
      if elem.text == "any string" then
        return pandoc.RawInline ("latex", "anything")
      end
    end,
  }
}

我可以包含一個 if 語句,上面寫着:如果 output 文件是 latex,那么使用這段代碼,如果 output 文件是 html(或不是乳膠),那么這樣做......

所以我基本上想知道是否有辦法在 lua-filter 中找出 output 文件格式。

是的,這是可能的。 查看這個 pandoc lua 過濾器示例: https://pandoc.org/lua-filters.html#center-images-in-latex-and-html-output特別是這些行:

if FORMAT:match 'latex' then
...
if FORMAT:match 'html' then

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM