actually, i do some filtering for the markdown to LaTeX transformation. I use lua filters for this. Now i'd need to do something like this:
function Str (el)
if is_in_a_title(el) then
-- do this
else
-- do that
end
end
meaning that inside Str i want to check if the argument belongs to a chapter/section title. Is there any way to do this?
Re-posting what I wrote on the mailing list:
This is best done by running sub-filters:
local header_filter = {
Str = function (el)
-- do this
end
}
function Header (h)
return pandoc.util.walk_block(h, header_filter)
end
The header_filter
is just like a normal Lua filter. The walk_block
function applies that filter to all elements below the Header, and those elements only.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.