-
-
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
Conditionals evaluate truthiness #9661
Comments
The documentation for doctemplates say that the string In YAML, foo: false will set foo: "false" which will cause your conditional to trigger. Does that clear things up? |
Ah, I did not know that pandoc's templating system had a separate repo and documentation. This indeed clears it up. Maybe the pandoc user guide could link to it? In any case, thanks for taking the time to explain! |
I think that most of the relevant text has been copied into the pandoc manual, but if you find things that are missing, let us know. |
I can't seem to find the section on what counts as I've highlighted the differences in bold below. pandoc:
doctemplates:
|
This is just YAML. We should make this clearer and explain what is interpreted as a Boolean value in YAML. |
Let me know if this looks ok |
Looks good to me! Thanks a lot for taking the time. All the work you put into pandoc is greatly appreciated |
I've recently been working on a Typst template for Quarto via pandoc. I had a moment of confusion when I was setting a variable to
false
in the YAML block of the source file. My Typst template included the following conditional to pass the variable onto a Typst function in case it was set by the user.The Pandoc user guide states that "the
if
section is used if variable has a non-empty value". Thus I could not understand why the conditional was evaluating tofalse
. After some research I learned that conditionals actually check for truthiness of the variable. This used to be reflected in the manual in the past (see #4631) but was removed again with commit ac4067fJudging by the PR mentioned above this is expected behaviour. I would have found it helpful had the documentation explained this. I'm happy to draft a PR to add back the removed lines.
The text was updated successfully, but these errors were encountered: