diff options
author | Simon McVittie <smcv@debian.org> | 2014-07-11 22:08:08 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2014-07-11 22:08:08 +0100 |
commit | 3f4a93574071c004fc332a68b2cac1f70de7f940 (patch) | |
tree | 0639b4ca388d5503dae6143997dfa685ff9f8de5 /IkiWiki.pm | |
parent | 48c310ddbd45ac932495bcd5ece8f25b95e64528 (diff) | |
download | ikiwiki-3f4a93574071c004fc332a68b2cac1f70de7f940.tar ikiwiki-3f4a93574071c004fc332a68b2cac1f70de7f940.tar.gz |
trail: don't generate a costly dependency when forcing sort order
pagespec_match_list() makes the current page depend on the pagespec
being matched, so if you use [[!trailoptions sort="..."]] to force
a sort order, the trail ends up depending on internal(*) and is
rebuilt whenever anything changes. Add a new sort_pages() and use that
instead.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index e5da04a3b..be3dfce39 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2459,6 +2459,19 @@ sub pagespec_match ($$;@) { return $sub->($page, @params); } +# e.g. @pages = sort_pages("title", \@pages, reverse => "yes") +# +# Not exported yet, but could be in future if it is generally useful. +# Note that this signature is not the same as IkiWiki::SortSpec::sort_pages, +# which is "more internal". +sub sort_pages ($$;@) { + my $sort = shift; + my $list = shift; + my %params = @_; + $sort = sortspec_translate($sort, $params{reverse}); + return IkiWiki::SortSpec::sort_pages($sort, @$list); +} + sub pagespec_match_list ($$;@) { my $page=shift; my $pagespec=shift; |