asciidoctor / asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
https://kroki.io/
MIT License
146 stars 47 forks source link

asciidoctor-kroki `ruby-0.9.1` (latest available) does not work with asciidoctor `2.0.22` #444

Closed dduportal closed 3 months ago

dduportal commented 3 months ago

Hi! As caught in https://github.com/asciidoctor/docker-asciidoctor/pull/437/, asciidoctor-kroki ruby-0.9.1 (latest available) does not work with asciidoctor 2.0.22.

@mojavelinux recommens to use String#pack but I'm not good enough in Ruby to understand what it means (searching https://ruby-doc.org/3.3.0/String.html does not show me tangible result) so I'm opening an issue whether a PR.

mojavelinux commented 3 months ago

The equivalent code can be found here: https://github.com/ruby/base64/blob/master/lib/base64.rb#L328-L333

It would look something like this:

str = ([str].pack 'm0').tr '+/', '-_'
mojavelinux commented 3 months ago

The extension shouldn't be relying on Asciidoctor to load a library from stdlib (and base64 is being removed from the stdlib in Ruby 3.4 anyway).

ggrossetie commented 3 months ago

That's weird to remove such as useful and tiny lib from stdlib 🤔 I wonder why they thought it was a good idea.

mojavelinux commented 3 months ago

I totally agree that it was a very unwise choice.

jaskij commented 3 months ago

In the meantime, is a workaround available?

mojavelinux commented 3 months ago

You can also just add -r base64 when invoking the asciidoctor command.

dduportal commented 3 months ago

Thanks @ggrossetie , I'll watch when the new release will be available to ensure the Docker image of asciidoctor picks it!

dduportal commented 3 months ago

Hello @ggrossetie @mojavelinux could we release a new version of asciidoctor-kroki to ensure the fix is available (as it is blocking https://github.com/asciidoctor/docker-asciidoctor/pull/437)?

As I'm requesting this, I do not mind to help if needed (and possible in term of permissions of course)

ggrossetie commented 3 months ago

Sorry forgot to push the release, 0.10.0 should be available soon

ggrossetie commented 3 months ago

@dduportal Could you please give it a try https://rubygems.org/gems/asciidoctor-kroki/versions/0.10.0 ?

dduportal commented 3 months ago

@dduportal Could you please give it a try https://rubygems.org/gems/asciidoctor-kroki/versions/0.10.0 ?

Many thanks @ggrossetie !

ggrossetie commented 3 months ago

Awesome 👍🏻