]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/trail.pm
Added a comment: Solution
[git.ikiwiki.info.git] / IkiWiki / Plugin / trail.pm
index b1bb6d5b532fb25120f6da1d4a371e43e04cfb72..01e17d61465e70de1c725eec20860e3b1a0e1478 100644 (file)
@@ -160,7 +160,7 @@ sub preprocess_trailitems (@) {
 
        if (exists $params{pagenames}) {
                push @{$pagestate{$params{page}}{trail}{contents}},
 
        if (exists $params{pagenames}) {
                push @{$pagestate{$params{page}}{trail}{contents}},
-                       [pagenames => (split ' ', $params{pagenames})];
+                       [pagenames => (map { linkpage $_ } split ' ', $params{pagenames})];
        }
 
        return "";
        }
 
        return "";
@@ -319,10 +319,9 @@ sub prerender {
                }
 
                if (defined $pagestate{$trail}{trail}{sort}) {
                }
 
                if (defined $pagestate{$trail}{trail}{sort}) {
-                       # re-sort
-                       @$members = pagespec_match_list($trail, 'internal(*)',
-                               list => $members,
-                               sort => $pagestate{$trail}{trail}{sort});
+                       @$members = IkiWiki::sort_pages(
+                               $pagestate{$trail}{trail}{sort},
+                               $members);
                }
 
                if (IkiWiki::yesno $pagestate{$trail}{trail}{reverse}) {
                }
 
                if (IkiWiki::yesno $pagestate{$trail}{trail}{reverse}) {
@@ -344,8 +343,6 @@ sub prerender {
                        $prev = $members->[$i - 1] if $i > 0;
                        my $next = $members->[$i + 1];
 
                        $prev = $members->[$i - 1] if $i > 0;
                        my $next = $members->[$i + 1];
 
-                       add_depends($member, $trail, deptype("presence"));
-
                        $member_to_trails{$member}{$trail} = [$prev, $next];
                }
 
                        $member_to_trails{$member}{$trail} = [$prev, $next];
                }
 
@@ -413,6 +410,8 @@ sub pagetemplate (@) {
        my $page = $params{page};
        my $template = $params{template};
 
        my $page = $params{page};
        my $template = $params{template};
 
+       return unless length $page;
+
        if ($template->query(name => 'trails') && ! $recursive) {
                prerender();
 
        if ($template->query(name => 'trails') && ! $recursive) {
                prerender();
 
@@ -438,13 +437,11 @@ sub pagetemplate (@) {
                        my ($prevurl, $nexturl, $prevtitle, $nexttitle);
 
                        if (defined $prev) {
                        my ($prevurl, $nexturl, $prevtitle, $nexttitle);
 
                        if (defined $prev) {
-                               add_depends($params{destpage}, $prev, deptype("presence"));
                                $prevurl = urlto($prev, $page);
                                $prevtitle = title_of($prev);
                        }
 
                        if (defined $next) {
                                $prevurl = urlto($prev, $page);
                                $prevtitle = title_of($prev);
                        }
 
                        if (defined $next) {
-                               add_depends($params{destpage}, $next, deptype("presence"));
                                $nexturl = urlto($next, $page);
                                $nexttitle = title_of($next);
                        }
                                $nexturl = urlto($next, $page);
                                $nexttitle = title_of($next);
                        }