Opened 10 years ago

Last modified 9 years ago

#4005 new enhancement

Allow user to pass optional arguments to graphviz processor

Reported by: jimc Owned by: Christian Boos
Priority: normal Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10


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 [4635] 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.

Other considerations:

  • 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!

Attachments (1)

ticket-4005.patch (3.8 KB) - added by jimc 10 years ago.
patch discussed in #4005

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by jimc

Attachment: ticket-4005.patch added

patch discussed in #4005

comment:1 Changed 10 years ago by jimc

mmm, something in that patch seems to be broken for anything *except* graphviz.neato-n1 invocations ... I'll look at it later, sry. I suspect my initial testing was invalus because of previously cached files ... but the idea is still close to correct.

comment:2 Changed 9 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Christian Boos.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.