diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-09-25 21:13:14 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-09-25 21:13:14 +0000 |
commit | 48e004acb1cd8d09dfa52377bd48edaee293bc9f (patch) | |
tree | 73f995849b4f779efbb92b559813cbc10addbc42 /IkiWiki | |
parent | 08db946cf4fb3c9289d130207d1d7d35741d97fa (diff) |
* inline: Add ability to sort by page name, based on a patch from
Benjamin A'Lee.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 79e64beac..868f3816f 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -59,7 +59,17 @@ sub preprocess_inline (@) { #{{{ push @list, $page; } } - @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; + + if (exists $params{sort} && $params{sort} eq 'title') { + @list=sort @list; + } + elsif (! exists $params{sort} || $params{sort} eq 'age') { + @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; + } + else { + return "unknown sort type $params{sort}"; + } + if ($params{show} && @list > $params{show}) { @list=@list[0..$params{show} - 1]; } |