fix links to inserted parent pages
authorJoey Hess <joey@kodama.kitenet.net>
Sat, 23 Aug 2008 16:28:18 +0000 (12:28 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sat, 23 Aug 2008 16:28:18 +0000 (12:28 -0400)
The parent page names had "/" prepended, which caused broken links.

IkiWiki/Plugin/map.pm

index 4a89fbc35ffc738ddf078c9bbc439a9251c31f3b..429493b9ef4f9b61cd0fd354d25772cd155ecf7c 100644 (file)
@@ -106,22 +106,22 @@ sub preprocess (@) { #{{{
                        }
                }
                my @bits=split("/", $item);
-               my $p="";
-               $p.="/".shift(@bits) for 1..$indent;
                while ($depth > $indent) {
                        $indent++;
                        if ($indent > 1) {
                                $map .= "<ul>\n";
                        }
                        if ($depth > $indent) {
-                               $dummy=1;
-                               $p.="/".shift(@bits);
+                               my $p="";
+                               $p.="/".shift(@bits) for 1..$indent+1;
+                               $p=~s/^\///;
                                $map .= "<li>"
                                        .htmllink($params{page}, $params{destpage},
                                                 $p, class => "mapparent",
                                                 noimageinline => 1)
                                        ."\n";
                                $openli=1;
+                               $dummy=1;
                        }
                        else {
                                $openli=0;