summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-02-24 23:32:03 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2018-02-24 23:38:27 +0100
commiteb16f3354f1926b66a06d2289b0bf394dc6e796c (patch)
tree9c2c6cc8666a3a5228ca39440399883742cbedf9
parentb5bd8a9461dc317ff61abec68feba4a86d39e9f2 (diff)
doc/lua-filters.md: document global vars set for filters
-rw-r--r--doc/lua-filters.md39
1 files changed, 36 insertions, 3 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 6f03360bb..0e07ee73a 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -135,9 +135,42 @@ Elements without matching functions are left untouched.
See [module documentation](#module-pandoc) for a list of pandoc
elements.
-The global `FORMAT` is set to the format of the pandoc writer
-being used (`html5`, `latex`, etc.), so the behavior of a filter
-can be made conditional on the eventual output format.
+
+## Global variables
+
+Pandoc passes additional data to Lua filters by setting global
+variables.
+
+`FORMAT`
+: The global `FORMAT` is set to the format of the pandoc
+ writer being used (`html5`, `latex`, etc.), so the behavior
+ of a filter can be made conditional on the eventual output
+ format.
+
+`PANDOC_READER_OPTIONS`
+: Table of the options which were provided to the parser.
+
+`PANDOC_VERSION`
+: Contains the pandoc version as a numerically indexed table,
+ most significant number first. E.g., for pandoc 2.1.1, the
+ value of the variable is a table `{2, 1, 1}`. Use
+ `table.concat(PANDOC_VERSION, '.')` to produce a version
+ string. This variable is also set in custom writers.
+
+`PANDOC_API_VERSION`
+: Contains the version of the pandoc-types API against which
+ pandoc was compiled. It is given as a numerically indexed
+ table, most significant number first. E.g., if pandoc was
+ compiled against pandoc-types 1.17.3, then the value of the
+ variable will be a table `{1, 17, 3}`. Use
+ `table.concat(PANDOC_API_VERSION, '.')` to produce a version
+ string from this table. This variable is also set in custom
+ writers.
+
+`PANDOC_SCRIPT_FILE`
+: The name used to involve the filter. This value can be used
+ to find files relative to the script file. This variable is
+ also set in custom writers.
# Pandoc Module