Lua filter: use destructured functions for inline filters

Instead of taking the whole inline element, forcing users to destructure it
themselves, the components of the elements are passed to the filtering
functions.
This commit is contained in:
Albert Krewinkel
2017-04-12 20:48:44 +02:00
parent 624ccbd45e
commit 2761a38e53
2 changed files with 63 additions and 37 deletions
+5 -4
View File
@@ -1,10 +1,11 @@
return {
{ Str = function (inline)
if inline.c == "{{helloworld}}" then
{
Str = function (str)
if str == "{{helloworld}}" then
return pandoc.Emph {pandoc.Str "Hello, World"}
else
return inline
return pandoc.Str(str)
end
end,
end,
}
}