summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2008-12-20 18:14:49 -0500
committerJoey Hess <joey@gnu.kitenet.net>2008-12-20 18:14:49 -0500
commit1c918a4ec6d5b9597d147278dff0d78343629f55 (patch)
tree26f324c37beaf87fa2862216ad76cfbdea674fb5 /doc
parent5d5732d67313a66f8acbb9b78ca3ed97c636f61a (diff)
response
Diffstat (limited to 'doc')
-rw-r--r--doc/bugs/inline_sort_order_and_meta_date_value.mdwn17
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/bugs/inline_sort_order_and_meta_date_value.mdwn b/doc/bugs/inline_sort_order_and_meta_date_value.mdwn
index 6357acdee..79d17ada2 100644
--- a/doc/bugs/inline_sort_order_and_meta_date_value.mdwn
+++ b/doc/bugs/inline_sort_order_and_meta_date_value.mdwn
@@ -40,3 +40,20 @@ If I instead include them using creation_year in the pagespec, they are ordered
> default sort order.
>
> -- [David A. Harding](http://dtrt.org), 2008-12-20
+
+Here is the code. As you can see, sort="age" is equivilant to leaving
+out the sort option. --[[Joey]]
+
+ if (exists $params{sort} && $params{sort} eq 'title') {
+ @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
+ }
+ elsif (exists $params{sort} && $params{sort} eq 'mtime') {
+ @list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
+ }
+ elsif (! exists $params{sort} || $params{sort} eq 'age') {
+ @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
+ }
+ else {
+ return sprintf(gettext("unknown sort type %s"), $params{sort});
+ }
+