asciidoctor/asciidoctor-diagram

D2: Set working directory for the process(?) to document dir so that relative images can be resolved.

eiswind opened this issue · 6 comments

Currently an image relative to the document cannot be resolved.

test: {
  shape: image
  icon: ./images/target.png
}

After a little digging i have to add that I'm running on JRuby. There is a "JAVA" switch there for the CLI Runner.
Doing Dir.pwd prints the documents directory, so this seems to be ok.

but d2 is using my Home-Directory for the basepath, but I did not find out where this is coming from.

Can anyone give me a pointer here?

@eiswind could you give df004ec a try on jruby? I've tested with MRI already and that works correctly now afaict.

Thanks for your support! First to say I have little to absolutely no clue about what I'm doing here.

What I'm doing is kind of hacky as I'm using artifacts from asciidoctorj with maven.
There I can override some files (not knowing what I'm doing) using local requires.
This seems to work for converter.rb where I did the sketch patch.

When I try to add the cli_generator (which pulls in java.rb etc) it fails with
undefined method `put' for #Asciidoctor::Diagram::D2Converter:0x65f1bf2c
Does that mean anything to you?

looking at the build files for asciidoctorj-diagram i have no idea how to build that from ruby sources as it uses a gem download.

Not sure what the put error is about, but it looks like I made a couple of small mistakes. The tests were failing as well. I've tweaked the code a bit and things seem to be working correctly under jruby as well now.

Thanks again. This Maven Setup is a pain when it comes to patching.

I can confirm that this is ok now.