]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
map: The fix for #449285 was buggy and broke display of parents in certian circumstances.
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 26 Aug 2008 16:55:43 +0000 (12:55 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 26 Aug 2008 16:55:43 +0000 (12:55 -0400)
The use of $dummy was not sufficient, because it only stuck around for the
first element after a dummy parent, and was then lost. Instead, use a
$addparent that contains the actual dummy parent, so it can be compared
with the new item to see if we're still under that parent or have moved to
another one.
(cherry picked from commit 9b10f5eab22be36cf3b3a217076c76a669b4aafa)

IkiWiki/Plugin/map.pm
debian/changelog

index 5b6a843e7ae2680d654317fc35368190c2d9d087..1a3204988d3a6bb593e9dee76cd138ba4c266b19 100644 (file)
@@ -71,7 +71,7 @@ sub preprocess (@) { #{{{
        my $parent="";
        my $indent=0;
        my $openli=0;
-       my $dummy=0;
+       my $addparent="";
        my $map = "<div class='map'>\n<ul>\n";
        foreach my $item (sort keys %mapitems) {
                my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
@@ -81,14 +81,14 @@ sub preprocess (@) { #{{{
                my $baseitem=IkiWiki::dirname($item);
                while (length $parent && length $baseitem && $baseitem !~ /^\Q$parent\E(\/|$)/) {
                        $parent=IkiWiki::dirname($parent);
-                       last if !$dummy && length $parent && $baseitem =~ /^\Q$parent\E(\/|$)/;
+                       last if length $addparent && $baseitem =~ /^\Q$addparent\E(\/|$)/;
+                       $addparent="";
                        $indent--;
                        $map .= "</li>\n";
                        if ($indent > 0) {
                                $map .= "</ul>\n";
                        }
                }
-               $dummy=0;
                while ($depth < $indent) {
                        $indent--;
                        $map .= "</li>\n";
@@ -105,11 +105,12 @@ sub preprocess (@) { #{{{
                                $map .= "<ul>\n";
                        }
                        if ($depth > $indent) {
-                               $dummy=1;
                                $p.="/".shift(@bits);
+                               $addparent=$p;
+                               $addparent=~s/^\///;
                                $map .= "<li>"
                                        .htmllink($params{page}, $params{destpage},
-                                                $p, class => "mapparent",
+                                                "/".$common_prefix.$p, class => "mapparent",
                                                 noimageinline => 1)
                                        ."\n";
                                $openli=1;
index 7afd852ce413767751cad28d4e3d4380cadcf26f..9b62fcb2921043a99079e648b178f2102505a033 100644 (file)
@@ -22,6 +22,8 @@ ikiwiki (2.53.1) UNRELEASED; urgency=low
   * inline: Ignore parent dirs when sorting pages by title.
   * external: Fix support for hooks called in an array context.
   * edittemplate: Don't wipe out edits on preview.
+  * map: The fix for #449285 was buggy and broke display of parents in certian
+    circumstances.
 
  -- Josh Triplett <josh@freedesktop.org>  Wed, 09 Jul 2008 21:30:33 -0700