htdebeer / pandocomatic

Automate the use of pandoc
https://heerdebeer.org/Software/markdown/pandocomatic/
GNU General Public License v3.0
158 stars 14 forks source link

SyntaxError in pandocomatic.yaml? #115

Closed plbt5 closed 1 year ago

plbt5 commented 1 year ago

Please review the following error, running the most default situation I can imagine:

Pauls-MacBook-Pro:2021_archSIOp paulbrandt$ pandocomatic
/Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/configuration.rb:28:in `require_relative': /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/pandocomatic_yaml.rb:64: syntax error, unexpected ',' (SyntaxError)
...ariable_does_not_exist, { key:, path: }) unless ENV.key? key
...                              ^
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/configuration.rb:28:in `<module:Pandocomatic>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/configuration.rb:21:in `<top (required)>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/cli.rb:25:in `require_relative'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/cli.rb:25:in `<module:Pandocomatic>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/cli.rb:21:in `<top (required)>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/pandocomatic.rb:31:in `require_relative'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/pandocomatic.rb:31:in `<module:Pandocomatic>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/lib/pandocomatic/pandocomatic.rb:21:in `<top (required)>'
    from <internal:/Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/pandocomatic-1.1.1/bin/pandocomatic:2:in `<top (required)>'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/bin/pandocomatic:25:in `load'
    from /Users/paulbrandt/.rbenv/versions/3.0.3/bin/pandocomatic:25:in `<main>'

Scrivomatic provides somewhat more debug info about the system:

---pandocomatic: /Users/paulbrandt/.rbenv/shims/pandocomatic | V: 
---paru library: V: 1.1.2
---rbenv versions:
  system
* 3.0.3 (set by RBENV_VERSION environment variable)
  3.2.2
---rbenv: /usr/local/bin/rbenv
---gem: /Users/paulbrandt/.rbenv/shims/gem
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

I'm probably overlooking something. Thanks in advance. Paul

htdebeer commented 1 year ago

I cannot reproduce the scenario with ruby 3.2.2. Can you try your scenario with ruby 3.2.2?

The issue seems caused by a environment variable that isn't defined. The place where the syntax error is thrown tries to print an error message telling you which variable isn't set.

htdebeer commented 1 year ago

I see that this {key: path:} syntax is introduced in Ruby version 3.1. So that explains why this doesn't work. Note that Ruby 3.0 is EOL soon, in early 2024.

htdebeer commented 1 year ago

Anyway, till then I can revert this.

htdebeer commented 1 year ago

Fix available in pandocomatic version 1.1.2.