Open iandol opened 1 year ago
As documented, we expand these for the defaults file fields that take file paths as arguments. metadata
doesn't -- it returns a structured metadata object. As you note, components of metadata might be file paths, but it's hard to know which of them are intended that way.
I think the example from the manual
https://pandoc.org/MANUAL.html#citation-rendering-1
should be changed to use top-level bibliography
etc.
... but it's hard to know which of them are intended that way.
Why can't ${...}
interpolate for other items? I assume Pandoc has a good reason to add in this limitation; are you worried about collision with possible content, i.e. maybe a user uses ${.}
to mean something in metadata; this does seem highly unlikely... How about "quoting" to handle this? I would really like to have relative paths expanded for resources that get passed into pandoc templates using metadata, and this restriction blocks this, requiring absolute paths and/or some script to rewrite yaml file paths across different machines etc. I'd assume there are more potential users who benefit from path interpolation than would be affected by any syntax collision?
I think the example from the manual should be changed to use top-level bibliography etc.
Yes, if you do not relax the interpolation rules than that makes sense.
I've updated the manual. Making this work in metadata
would require significant changes, and we'd have to drop the restriction to fields that are meant to be file paths, because there'd be no way to know which these are. That would mean that you couldn't include a literal ${HOME}
in metadata. For now I don't want to make that change, but we can leave the issue open.
OK, thank you for your consideration!
Explain the problem:
Given this defaults file:
When I try to compile I get an error:
So
${USERDATA}
is not expanding, however by moving those fields out ofmetadata
:So
bibliography
andcitation-abbreviations
are top level, now Pandoc finds the files:According to the manual, we should use
metadata
forcsl
&bibliography
but when I do${USERDATA}
fails to expand. My workaround (don't put them inmetadata
) is fine for this use case although the behaviour is unexpected.The manual does state:
So this is probably only tested for at the top-level?
In fact the manual example fails if you use the proposed position. e.g.
csl
should be in metadata, but the example shows csl used with${HOME}
Expected Result:
I would ideally hope we could use
${USERDATA}
within metadata bibliography fields too.Hoped for extensions:
Apart from
bibliography
I would also wish we could use${USERDATA}
or${HOME}
for other custom metadata fields, for example I have acopyright-image
field I'd like to link to my pandoc data directory so my defaults files do not contain absolute paths, but I cannot do this at present. Why is the use of${USERDATA}
or${HOME}
so restrictive?Pandoc version?