jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34k stars 3.35k forks source link

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

Open gabyx opened 3 years ago

gabyx commented 3 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