X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4cb343f3482edc3786ea46eea7efb7762d349164..15ddbb1c70fecb052ef45ae96574a4d888578d11:/IkiWiki/Plugin/graphviz.pm diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 0889bc9fc..479da6f73 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -95,6 +95,14 @@ sub render_graph (\%) { sub graph (@) { my %params=@_; + if (exists $params{file}) { + if (! exists $pagesources{$params{file}}) { + error gettext("cannot find file"); + } + $params{src} = readfile(srcfile($params{file})); + add_depends($params{page}, $params{file}); + } + # Support wikilinks in the graph source. my $src=$params{src}; $src="" unless defined $src; @@ -112,7 +120,15 @@ sub graph (@) { $p->handler(start => sub { my %attrs=%{shift()}; if (exists $attrs{href}) { - $s.="\"$attrs{href}\""; + if ($s=~/href\s*=\s*"$/) { + $s.=$attrs{href}; + } + elsif ($s=~/href\s*=\s*$/) { + $s.="\"$attrs{href}\""; + } + else { + $s.="href=\"$attrs{href}\""; + } } $nested++; }, "attr"); @@ -124,6 +140,7 @@ sub graph (@) { }, "text"); $p->parse($src); $p->eof; + $s=~s/\[ href= \]//g; # handle self-links $params{src}=$s; } else {