Setup of Plugins

Since the site needed to be exported as a static page I needed to be sure some of the plugins would work with this setup

Format Plugin

http://wiki.splitbrain.org/plugin:format

This one is quite handy, with it you can add a small section of text into the wiki
and have an image auto-generated such as a graph from gnuplot or a flow chart from graphviz

Here is a patch against version 2007-02-22 format.diff
This creates the png files in a directory within data/media/auto/format/namespace/pagename/image.png
Also it removes old files within the directory on the handle() function
it's not ideal way to do this, but it avoids lots of old image files being left in the directory when making small changes to diagrams

This is the current conf/default.php I'm using, it allows for changes to the formatting of the diagram within the php file
This is still a work in progress

<?php 
$conf['tmpdir']="/tmp";

/*  TODO substitue css values from style.ini / design.css in here somehow
    This would also need to work with offline templates */
$bg_col = "000000";
$line_col = "BFE8FF";
    
/*  Note if the formatting values are altered, it's best to reset the cache
    with "Cache/Revisions Eraser" to propogate the changes to all graphs
    individual graph formatting can be altered just by making a small change to the graph text in the wiki */


/*  Graphviz setup
    For altering the formatting of graphviz on the cmd line
    http://www.graphviz.org/doc/info/command.html
    http://www.graphviz.org/doc/info/attrs.html#k:color  */
$col_fmt =  "-Gbgcolor=#".$bg_col." "; // Background colour
$col_fmt .= "-Ecolor=#".$line_col." -Ncolor=#".$line_col." ";   // Line colour
$col_fmt .= "-Gfontcolor=#".$line_col." -Efontcolor=#".$line_col." -Nfontcolor=#".$line_col." "; // Font colour
foreach (array('dot','neato','twopi','circo','fdp') as $key => $prog) {
  $conf[$prog]=array('name' => "Graph",
     'xhtml' => array('ext' => 'png',
           'pre' => "",
           'post' => "",
           'command' => 'SERVER_NAME=xxx GV_FILE_PATH="" /usr/bin/'.$prog.' '.$col_fmt.' -Tpng -o @MEDIAFILE@ @INFILE@'));
}

/*  Gnuplot Setup
    For altering the formatting of gnuplot
    http://www.gnuplot.info/docs/node409.html#png
    http://www.nabble.com/Re:-Can-gnuplot-do-this--p14343954.html */
$col_fmt =  "set terminal png transparent nocrop enhanced size 420,320 ";
$col_fmt .= "x".$bg_col." "; // non-transparent background - Black
$col_fmt .= "x".$line_col." "; // borders - same as dark theme text colour
//$col_fmt .= "xFFFFFF "; // non-transparent background - White
//$col_fmt .= "x000000 "; // borders - Black
$col_fmt .= "x404040 "; // Axes - Grey
$col_fmt .= "xff0000 "; // - Red
$col_fmt .= "xffa500 "; // - orange
$col_fmt .= "x66cdaa "; // - medium aquamarine
$col_fmt .= "xcdb5cd "; // - thistle 3
$col_fmt .= "xadd8e6 "; // - light blue
$col_fmt .= "x0000ff "; // - blue
$col_fmt .= "xdda0dd "; // - plum
$col_fmt .= "x9500d3 "; // - dark violet
$conf['gnuplot']=array('name' => 'Plot',
   'xhtml' => array('ext' => 'png',
                    'pre' => $col_fmt."\nset output '@MEDIAFILE@'",
                    'post' => "\nexit\n",
                    'command' => 'cat @INFILE@ | /usr/bin/gnuplot'));

/*  GLE setup
    http://glx.sourceforge.net/
    TODO haven't tried this yet */
$conf['gle_graph']=array('name' => 'GLE Graph',
   'xhtml' => array('ext' => 'png',
                    'pre' => "",
                    'post' => "",
                    'command' => '/usr/bin/gle -safemode -r 200 -d png -output @MEDIAFILE@ @INFILE@ '));

/*  dpic setup
    TODO haven't tried this yet */
$conf['dpic']=array('name' => "PIC diagram",
   'xhtml' => array('ext' => 'png',
                    'pre' => ".PS\n",
                    'post' => "\n.PE\n",
                    'command' => '/usr/local/bin/dpic-safe -r @INFILE@ | /usr/bin/convert -density 200 - png:- > @MEDIAFILE@'));

Gnuplot example

http://www.gnuplot.info/
(gnuplot needs to be already installed, e.g. “emerge gnuplot” for gentoo) Plot

<format gnuplot>
plot [-20:20] sin(x)/x 
</format>

GraphViz example

http://www.graphviz.org/
(graphviz needs to be already installed, e.g. “emerge graphviz” for gentoo)
if using gentoo, enable the pango use flag for nicer anti aliased diagrams

Graph

<format neato>
digraph DokuWikiParser { 
        node [style=rounded, fontname=Arial, fontsize=13];
        edge [fontname=Arial, fontsize=11];
        P [label=Parser,         shape=box, pin=true, pos="1,3.5", color=red];
        H [label=Handler,        shape=box, pin=true, pos="3,2", color=blue, style="rounded,filled", fontcolor=black, fillcolor=blue];
        CC [label="Client Code", shape=box, pin=true, pos="3,3.5", color=green];
        L [label=Lexer,          shape=box, pin=true, pos="1,2", color=darkviolet];
        M [label=Modes,          shape=box, pin=true, pos="1,1", color=gold1];
        CC -> P [label="Input String"];
        H -> CC [label="Render\nInstructions"];
        P -> L  [label="Modes\n+\nInput String"];
        L -> H  [label=Tokens];
        L -> M  [arrowhead=none];  
</format>
 
Last modified 2008/03/02 13:55:46.
 
Creative Commons LicenseDonatePowered by PHPValid XHTML 1.0Valid CSSDriven by DokuWiki