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

Multiple --csl arguments give bad error message #8195

Closed
mgajda opened this issue Jul 22, 2022 · 5 comments
Closed

Multiple --csl arguments give bad error message #8195

mgajda opened this issue Jul 22, 2022 · 5 comments
Labels
bug CLI Command Line Interface good first issue

Comments

@mgajda
Copy link

mgajda commented Jul 22, 2022

Explain the problem.

If using pandoc within a build pipeline, one may mistakenly give two --csl arguments:

pandoc -s input.md --csl style1.csl --csl style2.csl -o output.pdf 

This will give a spurious error message when pandoc tries to find style1.csl style2.csl which is not a file.

The issue stems from the fact that Text.Pandoc.App.CommandLineOptions.addMeta tries to append data to the previous meta.
Unfortunately, --csl option does not treat the input as a list of styles, instead merges it.

Would it be more convenient to use separate replaceMeta (possibly with a warning when previous metadata was non-empty), or change parsing of meta only for CSL?

Currently Text.Pandoc.Citeproc.getStyle simply uses metaValueToText before trying to read it as a full path.

Pandoc version?

$ pandoc --version
pandoc 2.14.0.3
Compiled with pandoc-types 1.22, texmath 0.12.3.1, skylighting 0.10.5.2,
citeproc 0.4.0.1, ipynb 0.1.0.1
User data directory: /home/m/.local/share/pandoc
Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

This is Linux version.

@mgajda mgajda added the bug label Jul 22, 2022
@mgajda
Copy link
Author

mgajda commented Jul 22, 2022

I described the source of the error is appending to meta, and then using meta as a single file path.

@jgm
Copy link
Owner

jgm commented Jul 23, 2022

Would it be more convenient to use separate replaceMeta (possibly with a warning when previous metadata was non-empty), or change parsing of meta only for CSL?

Yes, I think that's a good idea. If you specify two --csl options, one should be ignored, with a warning.
Is this something you want to do a PR for?

@tarleb tarleb added good first issue CLI Command Line Interface labels Aug 3, 2022
@pt2121
Copy link
Contributor

pt2121 commented Aug 27, 2022

Can I take a stab at this?

@jgm
Copy link
Owner

jgm commented Aug 27, 2022

Go for it!

@pt2121
Copy link
Contributor

pt2121 commented Aug 28, 2022

I am looking into this and wondering if we should

  • let the user run pandoc with a warning,
  • or not run it and show an error message.

Any opinions on this?

@jgm jgm closed this as completed in 06c3928 Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CLI Command Line Interface good first issue
Projects
None yet
Development

No branches or pull requests

4 participants