56fb854ad8
This change makes it possible to define a catch-all function using lua's metatable lookup functionality. function catch_all(el) … end return { setmetatable({}, {__index = function(_) return catch_all end}) } A further effect of this change is that the map with filter functions now only contains functions corresponding to AST element constructors.
20 lines
354 B
Lua
20 lines
354 B
Lua
local num_inlines = 0
|
|
|
|
function catch_all(el)
|
|
if el.tag and pandoc.Inline.constructor[el.tag] then
|
|
num_inlines = num_inlines + 1
|
|
end
|
|
end
|
|
|
|
function Pandoc(blocks, meta)
|
|
return pandoc.Pandoc {
|
|
pandoc.Para{pandoc.Str(num_inlines)}
|
|
}
|
|
end
|
|
|
|
return {
|
|
setmetatable(
|
|
{Pandoc = Pandoc},
|
|
{__index = function(_) return catch_all end}
|
|
)
|
|
}
|