[dokuwiki] new plugin combining and generalizing the graphviz and gnuplot plugins

  • From: Jason Grout <jason-doku@xxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 29 Jan 2007 14:29:39 -0700

Hi everyone,

First, somewhat of an announcement. Then a request for help in managing configuration settings for a plugin.

A preliminary version of the plugin I'm describing is available at:

http://math.byu.edu/~grout/format.tar.gz

Prompted by the discussion in the "graphics in dokuwiki" thread and my own needs to be able to easily create media in dokuwiki pages, I looked closely at the graphviz and gnuplot plugins. The basic idea behind these plugins is to take a section of a wiki page, run it through an external program, save the resulting image, and then link to the image in the page. I've made a "format" plugin based on this code that does this base feature and then relies on configuration settings for the external applications. The default configuration file contains settings that allow the format plugin to replace the graphviz plugin, the gnuplot plugin, and also allow for GNU PIC diagrams, implemented by Dwight Aplevich's dpic software. However, the configuration file allows the administrator to configure any external program to work.

The syntax is similar to the box plugin. Here are a few examples from the default configuration.

<format dot>
graph { 1 -- 2 --4 2 -- 3 1--3 2--5 }
</format>

draws a graph using the "dot" program, creates the PNG file, and then links (and displays) the PNG file in the original wiki page.

<format gnuplot>
plot sin(x)
</format>

draws the graph of sin(x) using gnuplot, creates the PNG file, and then links (and displays) the PNG file in the original wiki page.

<format dpic>
box "start"
arrow right 2 "process" above
box "end"
</format>

(yeah, you guessed it) draws the diagram using dpic (an implementation of the PIC picture language), creates the PNG file, and then links (and displays) the PNG file in the original wiki page.

Of course, this plugin can be very dangerous (for example, the "shell" command in gnuplot would allow any person posting text to potentially execute arbitrary code on the server as the web server process). However, using the right programs in a properly sandboxed area, or in a trusted environment, it can be extremely useful.


My questions are:

* Is there a way to have user-editable configuration variables that are arrays? (I think the answer to this is no. If the answer is yes, then that takes care of the next question too.) I'd like the administrator to be able to specify any number of external programs, each with their own parameters for each different mode with which a page is rendered. * Is there a way to have the user enter a number of parameters an unspecified number of times? I'd like the user to be able to specify as many external tools as they want, with all the configuration settings for each external tool. * How exactly do I contribute this plugin to the dokuwiki project? I presume that I edit the wiki:plugins page to list this plugin and then create another page for the plugin. Is there a template that I can use to create the new page? * Anyone have any suggestions? (This is my first plugin, and really more of a rewrite of the graphviz plugin than anything else.)

-Jason

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: