pandoc / lua-filters

A collection of lua filters for pandoc
MIT License
611 stars 166 forks source link

Provide file path manipulations for lilypond and include-files #106

Closed gabyx closed 3 years ago

gabyx commented 4 years ago

Because of filters as lilypond and inlcude-files we need path manipulation utilities.

We need the PR from pandoc and another Lua implementation make_relative function.

The function make_relative could be a pure path computation, no filesystem needed. (no symlinks resolving, its probably not needed in a filter context...)

This implementation should be provided in hslua-system-module with for example a copy-implementation of makeRelativeEx

Lilipond:

replace realpath and dirname in lilypond with make_relative and [PR](https://github.com/jgm/pandoc/pull/6565 If the working dir is /a/b/c and the image directory /imagedir and relativize is enabled, an image /imagedir/img would resolve into ../../../imagedir/img. https://github.com/pandoc/lua-filters/blob/1c553017ecc58914c22bf2372902dca4a456929b/lilypond/lilypond.lua#L109

tarleb commented 3 years ago

The next pandoc version, probably either 2.11.4.1 or 2.11.5, will ship a new Lua module pandoc.path with the necessary functions. We should think about adding additional functions to that module, like canonicalize, but I'd expect it to be good enough for now.