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

warning: Passing safe_level with the 2nd argument of ERB.new is deprecated

iandol opened this issue · comments

I am currently seeing this warning using pandocomatic:

/Users/ian/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pandocomatic-0.2.7.4/lib/pandocomatic/printer/printer.rb:45: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
/Users/ian/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pandocomatic-0.2.7.4/lib/pandocomatic/printer/printer.rb:45: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.

I don't remember seeing it before but I haven't been using pandoc regularly recently so I'm not sure when it first surfaced (perhaps a gem update of ERB, i don't think I saw it when I first installed Ruby 3 but maybe I'm wrong)?

erb was gemified in Ruby 3 so perhaps that is why the warning is now exposed: https://stdgems.org/new-in/3.0/

Editing line 46 of printer.rb https://github.com/htdebeer/pandocomatic/blob/master/lib/pandocomatic/printer/printer.rb#L45 to this stops the warning:

            erb = ERB.new(File.read(@template), trim_mode: '>')

Thanks for the issue and the fix! I will implement it somewhere this week.

I can reproduce the issue by installing ruby 3.0.0 and installing the latest erb gem. Your fix works. I also updated the minimum ruby version to 2.6 because version 2.5's end of life is at the end of this month.

@htdebeer — is there a reason that ruby gems hasn't updated to use the new pandodocmatic version, it is still stuck at 0.2.7.4...

https://rubygems.org/gems/pandocomatic/

Yes, there is a reason: I forgot!

Fixed now :-)

Ha, no worries, I just used the gem file but was curious as to why! Take care, Ian