asciidoctor / asciidoctorj-pdf

AsciidoctorJ PDF bundles the Asciidoctor PDF RubyGem (asciidoctor-pdf) so it can be loaded into the JVM using JRuby.
Apache License 2.0
35 stars 17 forks source link

Problem with internal themes when packed in OSGi bundle #83

Open PartTimeDataScientist opened 1 year ago

PartTimeDataScientist commented 1 year ago

I am not sure if that's the right place to file this issue as a possible solution likely requires modifying upstream asciidoctor-pdf but I decided to file it here because the problem is presumably limited to specific usecases of asciidoctorj-pdf and maybe can serve as guidance for someone stumbling across the same problem.

I am using AsciidoctorJ to develop an Eclipse plugin and I realized that version 2.3.3 throws an (ENOTDIR) Not a directory - uri:classloader:/gems/asciidoctor-pdf-2.3.3/data/themes error (where 1.6.2 was working fine) that might be related to this JRuby issue (although this is supposed to be fixed and I am using JRuby-Complete 9.3.8.0).

My workaround is to extract the themes from the jar, bundle them outside of asciidoctorj-pdf in my jar and comment out line 16 in theme_loader.rb. Like I did with prawn.icon I am fine with monkey patching but maybe there is a different way of getting the theme file list that also works in these circumstances.

#BundledThemeNames = (::Dir.children ThemesDir).map {|it| it.slice 0, it.length - 10 }

robertpanzer commented 1 year ago

Could you please provide an example that reproduces the issue? Ideally outside of eclipse.