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

Issue setting a variable of type Dictionary from the command line #10298

Closed
ZoomRmc opened this issue Oct 17, 2024 · 2 comments
Closed

Issue setting a variable of type Dictionary from the command line #10298

ZoomRmc opened this issue Oct 17, 2024 · 2 comments
Labels

Comments

@ZoomRmc
Copy link

ZoomRmc commented Oct 17, 2024

I have a trouble setting up a variable of a type Dictionary from the command line.
From what I see in the docs, there's only one such variable, namely the margin for typst.

There's no problem setting it with the defaults YAML, but I'm not sure if pandoc currently can parse a dictionary from the command line.
The issue is exacerbated by a total lack of any error feedback on incorrectly formatted options from the CLI.

The following syntaxes should be equal:

  • CLI: -V margin={left:1cm, right:1cm, bottom:1cm, top:1cm, x:0cm, y:0cm}

  • defaults.yaml:

    variables:
      margin:
        left: 1cm
        right: 1cm
        bottom: 1cm
        top: 1cm
        x: 0cm
        y: 0cm

Tested on latest release (3.5).

@ZoomRmc ZoomRmc added the bug label Oct 17, 2024
@jgm
Copy link
Owner

jgm commented Oct 17, 2024

I'm not sure if pandoc currently can parse a dictionary from the command line.

It can't. Values are treated as literal strings; if no value is specified, the value will be boolean True. This needs to be made clearer in the manual under --variable.

(That's also why there's no error -- this is a legal string; at least, it would be if you put it in single quotes.)

@ZoomRmc
Copy link
Author

ZoomRmc commented Oct 17, 2024

This needs to be made clearer in the manual under --variable

That's more or less clear from the docs and from the code. But having a variable of a type that cannot be set is a a disconnect between the API as documented and the implementation and requires at least a note "can only be set from the YAML" for the specific variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants