From ae21a8bb2a9d892491424f257ed0146c1b2affa2 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sun, 30 Apr 2017 16:14:33 +0200 Subject: Lua filter: fall-back to global filters when none is returned The implicitly defined global filter (i.e. all element filtering functions defined in the global lua environment) is used if no filter is returned from a lua script. This allows to just write top-level functions in order to define a lua filter. E.g function Emph(elem) return pandoc.Strong(elem.content) end --- data/pandoc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data/pandoc.lua') diff --git a/data/pandoc.lua b/data/pandoc.lua index 31e46637c..2a5a945b5 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -803,7 +803,7 @@ end function M.global_filter() local res = {} for k, v in pairs(_G) do - if M.Inline.constructor[k] or M.Block.constructor[k] or M.Block.constructors[k] or k == "Doc" then + if M.Inline.constructor[k] or M.Block.constructor[k] or k == "Doc" then res[k] = v end end -- cgit v1.2.3