Allow user to pass optional arguments to graphviz processor
|Reported by:||jimc||Owned by:||Christian Boos|
For some graphs I'd like to put in the wiki, I need to manually control the layout. This is usually achieved by outputting the graph as canonical dot, editing the positions, and resubmitting through neato -n1 (i.e. the no-op layout option).
GraphvizPlugin doesn't currently allow the user to pass arguments to the graphviz commands. Attached is a patch to  that allows the user to specify -n1, -n2, or -x ; these are also considered when checking cache.
Badnesses in the patch:
- These are neato-only options, but I'm not testing for that.
- I didn't have a default argument to use, so the argument list allows an empty string, which means that the constructor in get_macros() doesn't include it.
- The empty string argument also looks ugly when tested for in render_macro() (when tested against Graphviz.Arguments)
- the argument goes last in the macro name (graphviz.processor/format-args) but in the middle in filenames (graphviz.processor.args.format)
- I've only provided a RegExp match, the string.split method doesn't detect it.
- I have invoked but not specifically tested the config.get clause in load_config().
- There is no way to see the canonical dot output of a graph through the wiki, in order to work out the node positions for meaningful use of -n1 and -n2. I've been running dot by hand from the command-line; not all users will have this facility easily available.
- Lots of interesting options take more specifiers (e.g. -G, -N, -E) -- however at the moment I'm matching against specific strings, not regexps.
- Some arguments may provide some attack vector into the server (i.e. -l library) or interfere with the plugin's expected behaviour.
- If a particular installation wants to have very specialised options, they could do worse than create a script in the same directory as the graphviz commands, and extend the Graphviz.Processors array. That was my first thought!