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;
$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");
}, "text");
$p->parse($src);
$p->eof;
+ $s=~s/\[ href= \]//g; # handle self-links
$params{src}=$s;
}
else {