* inline: Add ability to sort by page name, based on a patch from

Benjamin A'Lee.
master
joey 2006-09-25 21:13:14 +00:00
parent 08db946cf4
commit 48e004acb1
3 changed files with 20 additions and 1 deletions

View File

@ -59,7 +59,17 @@ sub preprocess_inline (@) { #{{{
push @list, $page; push @list, $page;
} }
} }
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; @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
}
else {
return "unknown sort type $params{sort}";
}
if ($params{show} && @list > $params{show}) { if ($params{show} && @list > $params{show}) {
@list=@list[0..$params{show} - 1]; @list=@list[0..$params{show} - 1];
} }

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ikiwiki (1.28) UNRELEASED; urgency=low
* inline: Add ability to sort by page name, based on a patch from
Benjamin A'Lee.
-- Joey Hess <joeyh@debian.org> Mon, 25 Sep 2006 17:06:39 -0400
ikiwiki (1.27) unstable; urgency=low ikiwiki (1.27) unstable; urgency=low
* Work on firming up the plugin interface: * Work on firming up the plugin interface:

View File

@ -32,3 +32,5 @@ directive:
* `actions` - If set to "yes" add links to the bottom of the inlined pages * `actions` - If set to "yes" add links to the bottom of the inlined pages
for editing and discussion (if they would be shown at the top of the page for editing and discussion (if they would be shown at the top of the page
itself). itself).
* `sort` - Controls how inlined pages are sorted. The default, "age" is to
sort newest pages first. Setting it to "title" will sort pages by title.