'Bumping' Ditaa version
kubamarchwicki opened this issue · 4 comments
Hi,
This is a bit 'yak shaving'ish - but here is the story.
Ditaa extension for asciidoctor-diagram (great stuff - btw) allows (recently - as of #69) for ditaa options.
One of the options on DItaa sourcecode is "transparent" background (https://github.com/stathissideris/ditaa/blob/master/src/org/stathissideris/ascii2image/core/CommandLineConverter.java#L71). However - this is not a feature available in the downloadable version of DItaa.
When I build Ditaa from source I can easily run it with
{ examples } master » java -jar /tmp/ditaa/releases/ditaa0_9.jar -S -T ditaa.txt /tmp/asciidoctor-diagram/examples
ditaa version 0.9, Copyright (C) 2004--2009 Efstathios (Stathis) Sideris
Running with options:
no-shadows
transparent
Reading file: ditaa.txt
Rendering to file: ditaa_3.png
Done in 0sec
Then for a following snippet
+-------------+
| asciidoctor |-------+
| diagram | |
+-------------+ | png out
^ |
| ditaa in |
| v
+--------+ +--------+----+ /---------------\
| | --+ asciidoctor +--> | |
| Text | +-------------+ |Beatiful output|
|Document| | !magic! | | |
| {d}| | | | |
+---+----+ +-------------+ \---------------/
: ^
| Lots of work |
+-----------------------------------+
I got result as expected (with transparent background!)
However that doesn't get supported by the diagram extension.
The ditaamini0_9.jar
doesn't look to me as a standard ditaa distribution and simple replacement of an old jar with a new build triggers a following error
Exception in thread "main" java.lang.NoSuchMethodError: org.stathissideris.ascii2image.text.TextGrid.loadFrom(Ljava/io/InputStream;Lorg/stathissideris/ascii2image/core/ProcessingOptions;)V
at org.asciidoctor.diagram.Ditaa.generate(Ditaa.java:61)
at org.asciidoctor.diagram.CommandProcessor.processRequest(CommandProcessor.java:34)
at org.asciidoctor.diagram.CommandServer.processRequests(CommandServer.java:38)
at org.asciidoctor.diagram.CommandServer.main(CommandServer.java:20)
asciidoctor-diagram: ERROR: Failed to generate image: end of file reached
Now, when I browse further - I see some more changes are required in here https://github.com/pepijnve/asciidoctor-diagram-java/blob/master/src/main/java/org/asciidoctor/diagram/Ditaa.java#L33
Before I start drilling there and fiddling with the code further, I just want to confirm that my thoughts are right. The steps should be
- update the ditaa.jar in the asciidoctor-diagram-java project
- fix the api changes
- apply "transparent" flag in both asciidoctor-diagram-java and asciidoctor-diagram
- pull request
Additional question, if the freshly built ditta.jar is not a drop-in replacement how can I reproduce the built of ditaamini0_9.jar
--Kuba
PS. My usecase. I started to use diagram for my training presentations. I have the diagrams together with slides and when it gets rendered into any html deck - the transparent background would make a bit more sense in some cases.
Hi Kuba,
When I was adding support for Ditaa in asciidoctor-diagram there was no proper release binary of Ditaa available for download. I forked the project, did some cleanup and packaged that up as ditaamini. It's 'mini' since it's pretty small and I stripped out all the code that requires additional external dependencies. Source repo is at https://github.com/pepijnve/ditaa
You're right that I did make some other small changes. I added that method to TextGrid to load Ditaa diagram source from an InputStream. That's much more convenient for my particular usage of Ditaa.
As for the missing transparent options, I accidentally missed it. I had based myself on the documentation at http://ditaa.sourceforge.net/#usage which doesn't list all the available options. I've gone ahead and added support for the missing rendering options that ditaa supports (transparent
, background
and fixed-slope
).
Woow that was fast! 👍
Thx - the description was quite elaborate as I was thinking of setting up pull request but you didt so fast :) great stuff
--Kuba
The 1.3.0 release was long overdue and this request gave me just enough of a push to just finish it. :)
👍