Skip to content
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

Inconsistent UI: --filter searches the path but --lua-filter does not #5438

Closed
niclasmattsson opened this issue Apr 9, 2019 · 4 comments
Closed

Comments

@niclasmattsson
Copy link

This could be a Windows issue, I haven't tested this on Linux or Mac. But on my Windows machine, this is how pandoc filters behave:

C:\Stuff>where testfilter*
C:\Stuff\testfilter2.lua
C:\Stuff\Scripts\testfilter1.exe
C:\Stuff\Scripts\testfilter3.lua

C:\Stuff>pandoc test.md --filter testfilter1 -s -o test.pdf

C:\Stuff>pandoc test.md --lua-filter testfilter2.lua -s -o test.pdf

C:\Stuff>pandoc test.md --lua-filter testfilter3.lua -s -o test.pdf
Error running filter testfilter3.lua:
testfilter3.lua: openBinaryFile: does not exist (No such file or directory)

C:\Stuff>pandoc test.md --lua-filter Scripts/testfilter3.lua -s -o test.pdf

C:\Stuff>

This isn't entirely undocumented. For example, running pandoc --help returns this:

C:\Stuff>pandoc --help
[...]
  -F PROGRAM            --filter=PROGRAM
                        --lua-filter=SCRIPTPATH
[...]

But I didn't find any direct mention of this in the --lua-filter README. In any case, I think the solution is not to improve the docs but to make the behavior more consistent, i.e. have --lua-filter search the path just like --filter does.

Potentially related filter path issues (all on Windows): #3563 , #3458, #3247.

@jgm
Copy link
Owner

jgm commented Apr 9, 2019

Not clear that it makes sense to make a lua filter executable and put it on the path.

Unlike regular filters, which read from stdin and write to stdout, lua filters don't really serve as standalone programs. If you run one, it will do exactly nothing. They only do their filtering magic when interpreted by pandoc.

@niclasmattsson
Copy link
Author

Thanks, I understand that rationale. But out of curiosity, what was the reason for the design decision to not have pandoc lua filters work as standalone filters in the same way as ordinary filters? In systems that don't have a standalone Lua interpreter the filters would still do nothing, but they could potentially do useful double duty on systems that have the interpreter.

@jgm
Copy link
Owner

jgm commented Apr 10, 2019 via email

@niclasmattsson
Copy link
Author

I see, thanks for explaining!

@jgm jgm closed this as completed Apr 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants