Skip to content

Lua support for resolving files in the data directory #9854

Closed
@jeffvalk

Description

@jeffvalk

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:

  1. Add new function get(template_name) to module pandoc.template, which locates the named template in the "templates" directory, and reads and returns its text content, similarly to existing function pandoc.template.default.

  2. Add new function data_file(name) to module pandoc.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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions