From 1c918a4ec6d5b9597d147278dff0d78343629f55 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 20 Dec 2008 18:14:49 -0500 Subject: response --- doc/bugs/inline_sort_order_and_meta_date_value.mdwn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'doc') 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}); + } + -- cgit v1.2.3