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

Convert boolean-like command-line variables to booleans like for metadata #10341

Open
bpj opened this issue Oct 30, 2024 · 0 comments
Open

Convert boolean-like command-line variables to booleans like for metadata #10341

bpj opened this issue Oct 30, 2024 · 0 comments
Assignees

Comments

@bpj
Copy link

bpj commented Oct 30, 2024

I tried unsuccessfully to use a variable like -V foo as a boolean in Lua.
Something like -M foo, -M foo=true or -M foo=false does indeed result in a boolean value for that metadata field in Lua.
[EDIT: note that -M foo without a value results in a true value!]

With -V foo pandoc.utils.type returns "Doc" for the value of PANDOC_WRITER_OPTIONS.variables.foo, but apparently that value stringifies to "true"! I find this doubly confusing as I had expected a boolean.

Using a variable for a filter switch would be more convenient as it could be accessed "directly" rather than writing a Meta filter which extracts the value from metadata and assigns it to a script-wide variable before running the main filter.

Obviously I could write code which converts a Doc to a string and a string which "looks like a bool" to a bool but should that really be necessary?

Originally posted by @bpj in #10340 where @tarleb said I should report this as a bug.

@tarleb tarleb self-assigned this Oct 30, 2024
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