]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/graphviz.pm
also search
[git.ikiwiki.info.git] / IkiWiki / Plugin / graphviz.pm
index 0889bc9fcd6720741679dec990f2d4349e866029..d4018edaaf9dad384818488356a3e7e8c4d8841c 100644 (file)
@@ -112,7 +112,15 @@ sub graph (@) {
                $p->handler(start => sub {
                        my %attrs=%{shift()};
                        if (exists $attrs{href}) {
                $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");
                        }
                        $nested++;
                }, "attr");
@@ -124,6 +132,7 @@ sub graph (@) {
                }, "text");
                $p->parse($src);
                $p->eof;
                }, "text");
                $p->parse($src);
                $p->eof;
+               $s=~s/\[ href= \]//g; # handle self-links
                $params{src}=$s;
        }
        else {
                $params{src}=$s;
        }
        else {