pandoc
pandoc copied to clipboard
PandocMonad: allow nested data files
Data file fallbacks are now also searched in the directory that has the same name as the file minus the extension. For example, a filter with name frob.lua will be searched in $DATADIR/filters/frob.lua as well as in $DATADIR/filters/frob/frob.lua.
This allows to place full git repositories in the data directory.
Closes: #6635
I'm on the fence about this. I see how it meets a need in the case of filters, but (a) it's slightly "magic" in the way it derives the directory name and (b) it applies to all data files, not just filters.
A narrower intervention would do this just for filters.
I'm just not sure what's best, hence the delay in merging this!
A narrower intervention would do this just for filters.
I'm just not sure what's best, hence the delay in merging this!
I wonder if we could downscope it to just the filters for now, and then if a need arises for other things in future, then it could be expanded to those when an appropriate use case is presented?
I think my thoughts back when I opened this were that this would also enable (or rather, simulate) "packages" in the sense that templates, filter, etc. could all be placed in a directory together with a defaults file. It would be easier to call -d package than -d package/package.
Now I tend to think that it might be better to invest the time into a proper package system to bundle files into a package. I think that would mostly serve the same use-case as this PR.
See also the discussion in #10874. The consensus there seemed to be that frob/init.lua would be most idiomatic. I still plan to submit a PR for that at some stage.