Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Bumping' Ditaa version #76

Closed
4 tasks
kubamarchwicki opened this issue Aug 3, 2015 · 4 comments
Closed
4 tasks

'Bumping' Ditaa version #76

kubamarchwicki opened this issue Aug 3, 2015 · 4 comments
Milestone

Comments

@kubamarchwicki
Copy link

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!)
ditaa_3

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.

pepijnve pushed a commit that referenced this issue Aug 4, 2015
#76 Add support for additional Ditaa options
pepijnve pushed a commit to pepijnve/asciidoctor-diagram that referenced this issue Aug 4, 2015
@pepijnve
Copy link
Member

pepijnve commented Aug 4, 2015

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).

@pepijnve pepijnve added this to the 1.3.0 milestone Aug 4, 2015
@pepijnve pepijnve closed this as completed Aug 4, 2015
@kubamarchwicki
Copy link
Author

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

@pepijnve
Copy link
Member

pepijnve commented Aug 4, 2015

The 1.3.0 release was long overdue and this request gave me just enough of a push to just finish it. :)

@mojavelinux
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants