Pandoc Lua过滤器:如果参数来自标题(章节或章节),如何签入函数Str

Pandoc Lua过滤器:如果参数来自标题(章节或章节),如何签入函数Str,lua,pandoc,Lua,Pandoc,实际上,我对从降价到乳胶的转换进行了一些过滤。我使用lua过滤器来实现这一点。现在我需要这样做: function Str (el) if is_in_a_title(el) then -- do this else -- do that end end 这意味着在Str中,我想检查参数是否属于章节标题。有什么方法可以做到这一点吗?重新发布我在邮件列表上写的内容: 这最好通过运行子过滤器来实现: local header_filter = { Str = fun

实际上,我对从降价到乳胶的转换进行了一些过滤。我使用lua过滤器来实现这一点。现在我需要这样做:

function Str (el)
  if is_in_a_title(el) then
    -- do this
  else
    -- do that
  end
end

这意味着在Str中,我想检查参数是否属于章节标题。有什么方法可以做到这一点吗?

重新发布我在邮件列表上写的内容:

这最好通过运行子过滤器来实现:

local header_filter = {
  Str = function (el)
    -- do this
  end
}

function Header (h)
  return pandoc.util.walk_block(h, header_filter)
end

header\u过滤器
与普通Lua过滤器一样。该函数将该筛选器应用于标题下的所有元素,并且仅应用于这些元素。

重新发布我在邮件列表上写的内容:

这最好通过运行子过滤器来实现:

local header_filter = {
  Str = function (el)
    -- do this
  end
}

function Header (h)
  return pandoc.util.walk_block(h, header_filter)
end
header\u过滤器
与普通Lua过滤器一样。该函数将该过滤器应用于标题下的所有元素,并且仅应用于这些元素