-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Relative file import in include-files filter #102
Comments
This is a good idea, but poses some problems. Lua, by default does not include the tools to deal with path modifications. Paths are platform dependent, with path separators
Neither is especially difficult, but both options require more work than I'm willing/able to invest right now. Patches would be most welcome. |
I can certainly do a PR. What do you mean with pure Lua? Isn’t there a std lib for path modifications? The path handling library by pandoc is haskell, right? With a python filter this would be really easy to acomplish, but I dont know about the |
Great! Lua aims to run on any platform that can be targeted with ANSI C. The latter has no concept of paths, so neither has Lua. Path libraries for Lua exist, but are all written in C, and thereby not an option. The necessary path manipulations should still be doable by pure string manipulations. The path library used in pandoc is filepath. If you are interested in how this can be exposed to Lua, check hslua-module-system, which exposes selected system and file related functions. Exposing filepath would best be done by adding the necessary bindings to that package. |
Probably these functions are the only ones which give enough access to do almost if not all path handling issues in filters: Any help and review is kindly welcome. |
What would be the next step to test a merged PR: hslua/hslua-module-system#1 Can we just version check the pandoc version in the include-files filter (is it possible?), such that we error out if somebody use a older pandoc version with no lua file manipulations functions...? |
Got it: :-) See jgm/pandoc#6565 |
@gabyx I think latest changes to include-files will solve this issue. Please check. |
@lmunch Thats really greate to hear: Is the doc already up to date, because I ve not seen any explanation on the feature? |
@gabyx See the Recursive transclusion section. It's default behaviour now, so no feature flag. |
@lmunch : Thanks for the effort! Its great! Sorry I was to impatient to read carefully! |
Resolved with #173 |
Would it make sense to add an attribute
relative-to-current-dir=true
or something such that, all paths or better all relative paths are resolved to the current file path we are currently at (maybe not so easy to distinguish platform independent, relative vs absolute paths).Therefore maybe, just replace a variable "${current-dir}/b/c.md" in all paths, which would give a deterministic and consistent way of relative imports :)?
@tarleb: What do you think?
In
a/b.md
or
In
a/b.md
The text was updated successfully, but these errors were encountered: