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
This commit is contained in:
Albert Krewinkel
2017-04-30 17:06:54 +02:00
parent 1afdccfa8c
commit ae21a8bb2a
4 changed files with 25 additions and 2 deletions
+6
View File
@@ -0,0 +1,6 @@
function Doc (doc)
local meta = {}
local hello = { pandoc.Str "Hello,", pandoc.Space(), pandoc.Str "World!" }
local blocks = { pandoc.Para(hello) }
return pandoc.Doc(blocks, meta)
end