jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.68k stars 3.39k forks source link

[Lua]: Enhance functionality to run filters in a Lua filter #6830

Open gabyx opened 4 years ago

gabyx commented 4 years ago

Currently there is only the option pandoc.utils.run_json_filter which is kind of limited. It needs the full path to the filter or it is found in PATH. Also we cannot run Lua filters.

I would like to have functionality to run all kinds of filters in a Lua filter, basically giving the function run_filter(doc, path, args...) a path or filename like anything which can also be defined in the meta data such as:

---
filters:
  - bla.lua
  - blub.lua
  - oh.py
  - pandoc-crossref
---

For example run_filter(doc, "blub.lua", FORMAT) would resolve the filter path as pandoc does it the normal way (by examining the current resource-path, etc)

wenbopeng commented 1 year ago

pandoc 3.1.2 solves this problem perfectly: Add running additional filters in include-files.lua · Issue #140 · pandoc/lua-filters