summaryrefslogtreecommitdiff
path: root/MANUAL.txt
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert+github@zeitkraut.de>2017-03-20 15:17:03 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-20 15:17:03 +0100
commitf2f6851713674545e2f303b95589cbaff8e6a6b9 (patch)
treea3b65213bb63aece6b0ae3726394abb153b1c7fd /MANUAL.txt
parentb010a8c5e7ba4969100fe078f0f9a1a6cdaf7c5c (diff)
Lua filters (#3514)
* Add `--lua-filter` option. This works like `--filter` but takes pathnames of special lua filters and uses the lua interpreter baked into pandoc, so that no external interpreter is needed. Note that lua filters are all applied after regular filters, regardless of their position on the command line. * Add Text.Pandoc.Lua, exporting `runLuaFilter`. Add `pandoc.lua` to data files. * Add private module Text.Pandoc.Lua.PandocModule to supply the default lua module. * Add Tests.Lua to tests. * Add data/pandoc.lua, the lua module pandoc imports when processing its lua filters. * Document in MANUAL.txt.
Diffstat (limited to 'MANUAL.txt')
-rw-r--r--MANUAL.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index b8954ea24..12e3b2f9e 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -457,6 +457,31 @@ Reader options
3. `$PATH` (executable only)
+`--lua-filter=`*SCRIPT*
+
+: Transform the document in a similar fashion as JSON filters (see
+ `--filter`), but use pandoc's build-in lua filtering system. The given
+ lua script is expected to return a list of lua filters which will be
+ applied in order. Each lua filter must contain element-transforming
+ functions indexed by the name of the AST element on which the filter
+ function should be applied.
+
+ The `pandoc` lua module provides helper functions for element
+ creation. It is always loaded into the script's lua environment.
+
+ The following is an example lua script for macro-expansion:
+
+ function expand_hello_world(inline)
+ if inline.c == '{{helloworld}}' then
+ return pandoc.Emph{ pandoc.Str "Hello, World" }
+ else
+ return inline
+ end
+ end
+
+ return {{Str = expand_hello_world}}
+
+
`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
: Set the metadata field *KEY* to the value *VAL*. A value specified