DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:ditaa

This is an old revision of the document!


Ditaa-Plugin

Compatible with DokuWiki

lemming, anteater, rincewind, angua, weatherwax, adora belle

plugin Converts ASCII-Flowcharts to png-Graphics using ditaa

Last updated on
2015-04-10
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to a2s, dataplot, diagram, flowchartjs, flowcharts, graphviz, svgedit, wavedrom

Tagged with diagram, images, java, media

Previous author: Dennis Ploeger

Ditaa is a tool to convert ASCII-Art flowcharts and diagrams into their graphical equivalents. This Plugin integrates this feature into DokuWiki. See the ditaa homepage for details about ditaa.

Download and Installation

Download and install the plugin using the Plugin Manager using the URL given above. Refer to Plugins on how to install plugins manually.

Changes

Configuration

The plugin provides a configuration setting in the config manager to specify the path to your Java interpreter. When set, the tool will run ditaa locally on your server to create the graphics. The ditaa jar file is included in the plugin, you do not need to download it separately.

When you do not provide a Java interpreter path in the config, the plugin will use the webservice at ditaa.org to create the images. Having Java available on your server is now completely optional!

Syntax

The syntax wraps any ditaa formatted ASCII flowchart into <ditaa></ditaa> tags. The opening tag can have several additional optional parameters (see below).

<ditaa [optional parameters]>
 
... (some ditaa-code) ...
 
</ditaa>

Parameters

Parameter Default Description
width=<num> width=0 Rescale the final image to this width. When set to 0, diita will choose the needed width and no rescaling is done.
height=<num> height=0 Same as above but for height. Only works when a width is given as well
<num>x<num> 0x0 Combines the above parameters into one. That's a lowercase x!
<float>X 1.0X Tells ditaa to scale the image. Eg. 2.0X makes the final image twice as big. That's an uppercase X
(no)round noround Enable or disable round corners for all boxes
(no)shadow shadow Enable or disable box shadows
(no)antialias antialias Enable or disable antialiasing
(no)edgesep edgesep Enable or disabling the separation of box edges where boxes directly touch
left center right Align the image to the left, center or right. Default does no alignment (inline)

Possible tags

Not all shape selector tags are documented on the ditaa site. A quick source scan revealed:

tag Description
{c} decision(Choice)
{d} document
{io} input/output, parallelogram
{mo} manual operation
{o} ellipse, circle
{s} storage
{tr} trapezoid (looks like an inverted {mo} )

Example

Ditaa Example

<ditaa round noedgesep right>
    +--------+   +-------+    +-------+
    |        | --+ ditaa +--> |       |
    |  Text  |   +-------+    |diagram|
    |Document|   |!magic!|    |       |
    |     {d}|   |  c478 |    |       |
    +---+----+   +-------+    +-------+
        :                         ^
        |       Lots of work      :
        +-------------------------+
</ditaa>

Discussion

Would it be possible to embed active dokuwiki links, or even implement an imagemap for the rendered png, so the boxes can become active links - a bit like flowchartwiki ? – LS 20120111

Workaround for wrong java version

Ditaa did not work out of the box as the servers default version of java was 1.5
I created therefor a small bat file called CorrectJavaDitaa.bat containing the following text:

CorrectJavaDitaa.bat
set JAVA_HOME=F:\oracle\product\middleware\jdk160_24
path %JAVA_HOME%\bin;%PATH%
java %*

F:\oracle\product\middleware\jdk160_24 is a version 1.6 of java ;-)
In the config screen of DokuWiki the value of java was set to the location of the bat file:

The path to your Java runtime interpreter (eg. /usr/bin/java). Leave empty to use remote rendering at ditaa.org. F:\Tools\Apache2.2\htdocs\dokuwiki\lib\plugins\ditaa\CorrectJavaDitaa.bat

Hope this may help others, also in setting other environmental parameters to get the jvm behave as needed
JH - 29-may-2013

thanks a lot. it is not just workaround, it is a must! I use version java1.7 AQ - 13-feb-2014

Bugs

Ditaa don't understand non-latin characters. For example: Cyrillic.

The server at ditaa.org seems to be down, and has not been responsive for a while. — Myron Turner 2012/12/04 04:00


Ditaa works with Cyrillic/Russian perfect! But in Dokuwiki preferences your must:

Ditaa Plugin pref

plugin»ditaa»java The path to your Java runtime interpreter (eg. /usr/bin/java). Leave empty to use remote rendering at ditaa.org.

- type something (without quotes) - “C:/Program Files/jre6/bin/java.exe”

broken.png is displayed / plugin doesn't render your image, OpenJDK

I found that ditaa recently broke on my system - running

 java -jar ditaa.jar testin.txt testout.png

from the command-line (where testin.txt contains some ditaa markup) produced

...
Caused by: java.lang.Error: Probable fatal error:No fonts found.
...

This seems to happen on OpenJDK on Linux, and was resolved by installing the dejavu font package. On Gentoo:

sudo emerge media-fonts/dejavu

tomgreen 2014-05-27 02:19

farm mode

This plugin fails in farm mode. Report to the Github issue.

You can workaround adding one line in <farmer>/lib/plugin/ditaa/syntax.php

    function _cachename($data,$ext){
        unset($data['width']);
        unset($data['height']);
        unset($data['align']);
  +++   unset($data['animal']);
        return getcachename(join('x',array_values($data)),'.ditaa.'.$ext);
    }

atisne 2014-10-10 15:25

plugin/ditaa.1432299735.txt.gz · Last modified: 2015-05-22 15:02 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki