Table of Contents

Ditaa-Plugin

ditaa plugin by Dennis Ploeger
Converts ascii-Flowcharts to png-Graphics using ditaa

Last updated on 2006-01-18. Provides Syntax.
Compatible with DokuWiki devel > 2005-09-22.

Similar to graphviz.

Tagged with flowcharts, graph, vizualisation.

See ditaa for details.

Installation

You can use the plugin-manager to install this plugin. Use: http://www.dieploegers.de/files/plugin-ditaa.zip.

Installation for Windows

Since there are some problems with the plugin-manager and getting this to work for Windows (and IIS), do the following:

Syntax


<ditaa name=<name> {width=<width> height=<height>}>

... (some ditaa-code) ...

</ditaa>

Example

This ascii-art:


<ditaa name=test>

+--------+     /--------\
|  Test  +---->| Test 2 |
+--------+     \--------/

</ditaa>

would produce this nice picture:

Pros

Cons

Plugin

When not using the plugin manager, download the zip-file and unzip it in your plugins-directory and everything should work.

Discussion

Do you have an idea how to enable exec()?

—ERROR CONVERTING DIAGRAM—

Checked command line for ditaa itself and it all works - it creates the .png file but cant get plugin to work. java -jar ditaa dit21.tmp.txt dit.png Windows 2003 and IIS

Its creating files in the temp dir

dit21.tmp - blank
dit21.tmp.txt - contains correct syntax for ditta

changed permissions added the java path and also path to ditaa jar.

anything else I can check.

Here are the code changes, the rest of the plugin remains unchanged:

class syntax_plugin_ditaa extends DokuWiki_Syntax_Plugin {

    var $ditaa_name = '';
    var $ditaa_width = -1;
    var $ditaa_height = -1;
    var $ditaa_data = '';
    var $pathToJava = 'java'; 
    var $pathToDitaa = 'ditaa.jar';
    var $tempdir = 'temp';

		/** 
		 * Add path to some of the variables
		 */
		function syntax_plugin_ditaa() {
			$this->pathToDitaa = realpath(dirname(__FILE__)).'/'.$this->pathToDitaa;
			$this->tempdir = realpath(dirname(__FILE__)).'/'.$this->tempdir;
		}
 

Additionally mkdir() is unable to create paths, only a directory subordinated to a existing one, so that code requires changes too. Plus if the path was unable to get created due to missing privileges, the conversion will be passed.

...
        $md5 = md5_file($tempfile.'.txt');

        $mediadir = $conf["mediadir"]."/".str_replace(":", "/",$INFO['namespace'] ); 

	// Create path for media
        if (!is_dir($mediadir)) {
		$dirs = explode('/',$mediadir);
		$dir='';
		foreach ($dirs as $part) {
			$dir.=$part.'/';
			if ( !is_dir($dir) && (strlen($dir)>0) ) { mkdir($dir, 0770); }
		}
        }

	// Check if the Media-Directory has been created
        if (!is_dir($mediadir)) {
		$renderer->doc.='<u>DITAA GRAPH:</u> Unable to create media location in ['.$mediadir.']. Check file system permissions.';
		return true;
        }

        $imagefile = $mediadir.'/ditaa_'.$this->ditaa_name.'_'.$md5.'.png';
        if ( !file_exists($imagefile)) {
...

Michael Pillwax - PILLWAX Industrial Solutions Consulting 2006-11-13


i am getting the error —ERROR CONVERTING DIAGRAM—

QUESTIONS about installation to get it working for me …

1 what java is required? any java.exe ?

2 where is the temp directory? i have spent much time looking for it … have given up .. please tell me

# $tempdir (for example %windir%\TEMP

3 where/how do i find the users as below

Ensure the users IUSR_xxxx and IWAM_xxxx have write permissions on the directory

OTHER QUESTIONS

1 would this plugin, in your opinion be the most suitable plugin for a family tree? for an example, see the second tree diagram Kingsmill (surname) and see example plugin wish dokuwiki plugin wish

2 is this plugin compatible with the latest version of dokuwiki?

3 is this plugin compatible with monobook theme?

QUESTION to get the plugin working for me

In the code below, is there anything which i need to change?

for example, in the code below, should i put my directory and if so, what would i put if my directory is

http://xxxx.com/xxxx/doku.php

function syntax_plugin_ditaa() {
			$this->pathToDitaa = realpath(dirname(__FILE__)).'/'.$this->pathToDitaa;
			$this->tempdir = realpath(dirname(__FILE__)).'/'.$this->tempdir;
		}
class syntax_plugin_ditaa extends DokuWiki_Syntax_Plugin {

    var $ditaa_name = '';
    var $ditaa_width = -1;
    var $ditaa_height = -1;
    var $ditaa_data = '';
    var $pathToJava = 'java'; 
    var $pathToDitaa = 'ditaa.jar';
    var $tempdir = 'temp';

		/** 
		 * Add path to some of the variables
		 */
		function syntax_plugin_ditaa() {
			$this->pathToDitaa = realpath(dirname(__FILE__)).'/'.$this->pathToDitaa;
			$this->tempdir = realpath(dirname(__FILE__)).'/'.$this->tempdir;
		}