htdebeer / pandocomatic

Automate the use of pandoc

Home Page:https://heerdebeer.org/Software/markdown/pandocomatic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multioptions in Yaml not passed correctly to Pandoc

herculosh opened this issue · comments

Hello Together

I am trying to integrate my own Minted Filter from Pandocomatic to Latex.
In the pandocomatic configuration. It looks like this (please take a look to pdf-engine-opt):

  education-slides:
    glob: ['*.md']
    extends: ['author','date','beamertex']
    preprocessors: []
    pandoc:
      filter: 
        - filters/pandoc-minted-beamer.py #pandoc-citeproc # process citations
      from: markdown
      to: beamer
      pdf-engine: lualatex
      pdf-engine-opt: --shell-escape
      pdf-engine-opt: --aux-directory=temp
      standalone: true

if I now kick pandocomatic at this template, I get the following --debug output.

pandoc	--filter=/Users/user/Documents/gitrepos/doz-ps-online/data-dir/filters/pandoc-minted-beamer.py \
	--from=markdown \
	--to=beamer \
	--pdf-engine=lualatex \
	--pdf-engine-opt=--aux-directory\=temp \
	--standalone \
	--output=/Users/user/Documents/gitrepos/doz-ps-online/output/Thema1.pdf

Pandoc responds with the following output on the console.

lualatex: unrecognized option '--aux-directory=temp'
lualatex: unrecognized option '--aux-directory=temp'
Error producing PDF.
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

It looks like both pdf options are not transferred to Pandoc. Is this a bug or have I made a mistake?

Thanks in Advance. Best Regards Ivo

This looks like a bug in paru: it assumes there is only a single --pdf-engine-opt option, whereas there can be multiple?

Anyway, if this is an issue, it is an easy fix. I'll create an issue for this in the paru repo

Hi @htdebeer you are really fast :-) Thank you very much, how do I get the fix on my system with gem?

So I updated paru to allow multiple --pdf-engine-opt options. Can you test if this solves your issue?

To test perform the following three steps:

  1. Uninstall paru by running gem uninstall paru in a terminal. Select the option All versions to remove them all. And then answer "yes" to all questions: you will reinstall paru in the next step.
  2. Install the latest paru version by running gem install paru in a terminal. It should tell you that paru-0.3.2.1 has been installed.
  3. Try your scenario again.

Please let me know if this solves the issue.

Hi @htdebeer

Those were the steps I followed.

Uninstall Paru...

$ gem uninstall paru                                                                                                                                                   
You have requested to uninstall the gem:
	paru-0.3.2.1

pandocomatic-0.2.5.2 depends on paru (>= 0.3.2.0, ~> 0.3.2)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Remove executables:
	pandoc2yaml.rb, do-pandoc.rb

in addition to the gem? [Yn]  Y
Removing pandoc2yaml.rb
Removing do-pandoc.rb
Successfully uninstalled paru-0.3.2.1

Uninstall Pandocomatic

$ gem uninstall pandocomatic                                                                                                                                           

Remove executables:
	pandocomatic

in addition to the gem? [Yn]  Y
Removing pandocomatic
Successfully uninstalled pandocomatic-0.2.5.2

Install Pandocomatic

$ gem install pandocomatic                                                                                                                                             -- INSERT --
Fetching pandocomatic-0.2.5.2.gem
Fetching paru-0.3.2.1.gem
Successfully installed paru-0.3.2.1
Successfully installed pandocomatic-0.2.5.2
Parsing documentation for paru-0.3.2.1
Installing ri documentation for paru-0.3.2.1
Parsing documentation for pandocomatic-0.2.5.2
Installing ri documentation for pandocomatic-0.2.5.2
Done installing documentation for paru, pandocomatic after 1 seconds
2 gems installed

Paru 0.3.2.1 is installed.

Then executed Pandocomatic again.

$ pandocomatic --config pandocomatic.yaml -i docs -o output -d data-dir --debug                                                                                        
18 commands to execute to convert '/Users/ivolooser/Documents/gitrepos/doz-ps-online/docs' to 'output'.
(18) + convert /Users/ivolooser/Documents/gitrepos/doz-ps-online/docs; enter output
(16)   - convert thema1.md -> Thema1.pdf
pandoc	--filter=/Users/user/Documents/gitrepos/doz-ps-online/data-dir/filters/pandoc-minted-beamer.py \
	--from=markdown \
	--to=beamer \
	--pdf-engine=lualatex \
	--pdf-engine-opt=--aux-directory\=temp \
	--standalone \
	--output=/Users/user/Documents/gitrepos/doz-ps-online/output/Thema1.pdf
lualatex: unrecognized option '--aux-directory=temp'
lualatex: unrecognized option '--aux-directory=temp'

It seems to be not working as expected.

I see also an issue with your template: a multi-value option should be a list in YAML. So,

      pdf-engine-opt: --shell-escape
      pdf-engine-opt: --aux-directory=temp

should be

      pdf-engine-opt: 
      - "--shell-escape"
      - "--aux-directory=temp"

Does that help?

That looks very smooth. Everything else is up to me now. Correct parameter transfer for Pandoc.

	--to=beamer \
	--pdf-engine=lualatex \
	--pdf-engine-opt=--shell-escape \
	--pdf-engine-opt=--aux-directory\=temp \
	--standalone \

You are great. Thanks.

You're welcome. Happy to help. I'll also update pandocomatic to use this new version of paru.