-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Template cannot be set using a Bash process substitution #5270
Comments
See the manual for `--template`:
If no extension is specified, an extension
corresponding to the writer will be added, so that
`--template=special` looks for `special.html` for HTML output.
The point of this is to allow you to do
--template=letter or --template=default and have the
right template for the format be used.
I'm sure there are ways to work around this for your
purposes. Or you may have a concrete suggestion as to
how pandoc could be changed without throwing away the
above feature. Otherwise, this should be closed.
|
Could it check to see if the bare filename-as-given, with no extension, exists, and use it if it does? (if it doesn't, then fall back to the current behaviour) |
That seems like a reasonable solution, though it would require a change to documented behavior. |
Could it use the path as is when an absolute path is provided and keep the current behavior when a basename is provided? |
Also a reasonable solution. But of course it may break things for people who are doing I suppose a very narrow fix would be to special-case absolute filenames beginning with |
Yes you are right.
That seems brittle tough. A couple other potential solutions (suggested names, could be better):
Or, potentially easier and better for shells that won't support process substitution:
This last option is not process substitution per say, but would allow for the same use case |
these seem like very overcomplicated solutions. given the current behaviour of:
would it not be simpler to modify the behaviour to:
this seems backwards-compatible (unless someone is relying on the current behaviour of "exit if $template.$ext does not exist") to me. |
I went for a slightly different approach: first look for the extensionless template, and fall back to adding the extension if it isn't found. This is slightly less backwards-compatible (but it's pretty unlikely that someone will use a template foo.markdown and just happen to have a file foo in the template search path). But it yields better error messages, since the failure occurs with the extension added. Anyway, bash process substitutions now work. |
Pandoc appears to silently append an extension to the template name if it feels like it, which means that you can't use a file which doesn't have the "correct" extension as a template:
Pandoc version: 2.3.1, reproduced on 2.6 (though then the extension added is
html
, notmarkdown
)The text was updated successfully, but these errors were encountered: