diff options
| author | Albert Krewinkel <[email protected]> | 2024-10-01 12:08:00 +0200 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2024-10-01 12:23:36 +0200 |
| commit | 4cf6ddb027cdc262e34dea50ec77f3fcdbc517d2 (patch) | |
| tree | c253d35d84b05c4eacffd4171be211e726602d1b /doc | |
| parent | 752d57dac18b2381fb05972cccdc21ea16d242cd (diff) | |
Lua: allow returning a single filter from filter files
It is now possible to return a single filter from a filter file, e.g.
``` lua
-- Switch single- and double quotes
return {
Quoted = function (q)
elem.quotetype = elem.quotetype == 'SingleQuote'
and 'DoubleQuote' or 'SingleQuote'
return elem
end
}
The filter must not contain numerical indexes, or it might be treated as
a list of filters.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lua-filters.md | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md index 8b8dbfc47..0ac8a22f0 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -40,11 +40,9 @@ to small caps: ``` lua return { - { - Strong = function (elem) - return pandoc.SmallCaps(elem.content) - end, - } + Strong = function (elem) + return pandoc.SmallCaps(elem.content) + end, } ``` @@ -187,7 +185,7 @@ local filter = { traverse = 'topdown', -- ... filter functions ... } -return {filter} +return filter ``` Support for this was added in pandoc 2.17; previous versions |
