git.iko.soy/typeable/pandoc
on master help sign in
doc/lua-filters.md: document global vars set for filters
eb16f33Albert Krewinkel
doc/lua-filters.md+36−3
@@ -135,9 +135,42 @@ Elements without matching functions are left untouched.
135See [module documentation](#module-pandoc) for a list of pandoc
135See [module documentation](#module-pandoc) for a list of pandoc
136elements.
136elements.
137
137
138+
139+## Global variables
140+
141+Pandoc passes additional data to Lua filters by setting global
142+variables.
143+
144+`FORMAT`
138−The global `FORMAT` is set to the format of the pandoc writer
145+: The global `FORMAT` is set to the format of the pandoc
139−being used (`html5`, `latex`, etc.), so the behavior of a filter
146+ writer being used (`html5`, `latex`, etc.), so the behavior
140−can be made conditional on the eventual output format.
147+ of a filter can be made conditional on the eventual output
148+ format.
149+
150+`PANDOC_READER_OPTIONS`
151+: Table of the options which were provided to the parser.
152+
153+`PANDOC_VERSION`
154+: Contains the pandoc version as a numerically indexed table,
155+ most significant number first. E.g., for pandoc 2.1.1, the
156+ value of the variable is a table `{2, 1, 1}`. Use
157+ `table.concat(PANDOC_VERSION, '.')` to produce a version
158+ string. This variable is also set in custom writers.
159+
160+`PANDOC_API_VERSION`
161+: Contains the version of the pandoc-types API against which
162+ pandoc was compiled. It is given as a numerically indexed
163+ table, most significant number first. E.g., if pandoc was
164+ compiled against pandoc-types 1.17.3, then the value of the
165+ variable will be a table `{1, 17, 3}`. Use
166+ `table.concat(PANDOC_API_VERSION, '.')` to produce a version
167+ string from this table. This variable is also set in custom
168+ writers.
169+
170+`PANDOC_SCRIPT_FILE`
171+: The name used to involve the filter. This value can be used
172+ to find files relative to the script file. This variable is
173+ also set in custom writers.
141
174
142# Pandoc Module
175# Pandoc Module
143
176