apply Postel's law
authorJoey Hess <joey@kitenet.net>
Wed, 30 Nov 2011 20:25:17 +0000 (16:25 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 30 Nov 2011 20:25:17 +0000 (16:25 -0400)
IkiWiki/Plugin/graphviz.pm

index 0889bc9fcd6720741679dec990f2d4349e866029..b9f997e04b123a11a50aa9dddac82d982fb2fbf7 100644 (file)
@@ -112,7 +112,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");