Description
Add Lua support for resolving and reading files from the data directory. At minimum, this should support loading named templates. Ideally, this would enable API access to any type of file stored in the data directory.
From discussion #9853:
It would feel more "batteries included" in the API, and it would give filter/reader/writer authors an indication that they're working with Pandoc's architecture and not against it.
Thoughts:
-
Add new function
get(template_name)
to modulepandoc.template
, which locates the named template in the "templates" directory, and reads and returns its text content, similarly to existing functionpandoc.template.default
. -
Add new function
data_file(name)
to modulepandoc.utils
(or elsewhere), which resolves a relative path in the data directory and returns an absolute file path if the file exists, or nil if does not. This would provide a standard mechanism to allow any data directory file to be read, added to the media bag, etc.