Does Pandoc expose variables set on the command line ( pandoc -V foo=bar
) to scripts running inside the built in lua filter environment ? In other words if I run:
pandoc -V foo=bar --lua-filter=myfilter.lua
...what can I put in myfilter.lua
to access foo
?
(Since: pandoc 2.17)
PANDOC_WRITER_OPTIONS.variables["foo"]
This is documented a bit in the description for the --metadata
:
Like
--variable
,--metadata
causes template variables to be set. But unlike--variable
,--metadata
affects the metadata of the underlying document (which is accessible from filters and may be printed in some output formats) and metadata values will be escaped when inserted into the template.
So, I think that using -M
to set a variable will give you access to the variable inside your lua filter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.