diff options
author | Simon McVittie <smcv@debian.org> | 2012-04-06 17:05:26 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2012-04-06 17:05:26 +0100 |
commit | 258ee1bc3b9c43807064c771ebcb9ce2840d4264 (patch) | |
tree | 2f3dc9f533efd7253ef2ec07afa1386951e1aa68 /IkiWiki/Plugin/trail.pm | |
parent | 4a4610e66e7dd548843bdf69d2b59e612ebeabd3 (diff) | |
download | ikiwiki-258ee1bc3b9c43807064c771ebcb9ce2840d4264.tar ikiwiki-258ee1bc3b9c43807064c771ebcb9ce2840d4264.tar.gz |
trail, inline: treat pagenames as a list of literal names, not links
Diffstat (limited to 'IkiWiki/Plugin/trail.pm')
-rw-r--r-- | IkiWiki/Plugin/trail.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/trail.pm b/IkiWiki/Plugin/trail.pm index b73961e66..34a2ca5b6 100644 --- a/IkiWiki/Plugin/trail.pm +++ b/IkiWiki/Plugin/trail.pm @@ -26,6 +26,8 @@ sub import { # # * $pagestate{$T}{trail}{contents} # Reference to an array of lists each containing either: +# - [pagenames => "page1", "page2"] +# Those literal pages # - [link => "link"] # A link specification, pointing to the same page that [[link]] # would select @@ -148,8 +150,8 @@ sub preprocess_trailitems (@) { } if (exists $params{pagenames}) { - my @list = map { [link => $_] } split ' ', $params{pagenames}; - push @{$pagestate{$params{page}}{trail}{contents}}, @list; + push @{$pagestate{$params{page}}{trail}{contents}}, + [pagenames => (split ' ', $params{pagenames})]; } return ""; @@ -271,6 +273,19 @@ sub prerender { $c->[1], sort => $c->[2], reverse => $c->[3]); } + elsif ($c->[0] eq 'pagenames') { + my @pagenames = @$c; + shift @pagenames; + foreach my $page (@pagenames) { + if (exists $pagesources{$page}) { + push @$members, $page; + } + else { + # rebuild trail if it turns up + add_depends($trail, $page, deptype("presence")); + } + } + } elsif ($c->[0] eq 'link') { my $best = bestlink($trail, $c->[1]); push @$members, $best if length $best; |