Page MenuHomePhabricator

Handling of > in dynamic graphs using dot language and dynamic preparse
Closed, DeclinedPublic

Description

Hi,

Please consider the following Graph:

<graphviz  preparse="dynamic">
  strict digraph FooBar{ 
    "Foo" {{#if:yes | -> }} "Bar"; 
  }
</graphviz>

since the arrow is passed through a parserfunction it will come back as -&gt; encoded with htmlspecialchars.

GraphViz then fails as it cannot interpret the dot-language. with

Warning: WIKI_Playground_strict_digraph_FooBar.src: syntax error in line 2 near '-'

As a workaround I added

$input = str_replace('&gt;', '>', $input);

in /Graphviz/includes/Graphviz.php on line 666, just after

if ( $doRecursiveTagParse ) {
  $input = $parser->recursiveTagParse( $input, $frame );
}

but maybe there is a better way to tackle this?

In my case I have a more complex parser function returning dotgraph language but the gist is the same.

Thanks, Istvan

MediaWiki1.32.0
PHP7.3.1 (cgi-fcgi)
MariaDB5.5.60-MariaDB
GraphViz3.0.0 (d7732c8)