X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/15c468d5aed3792623da85be88c9327502617f21..4481b2cc66f291da6ec310595a6706947f1b3f81:/doc/patchqueue/inline_-_sort_by_old_first.mdwn diff --git a/doc/patchqueue/inline_-_sort_by_old_first.mdwn b/doc/patchqueue/inline_-_sort_by_old_first.mdwn index 7501bbd15..9054beadc 100644 --- a/doc/patchqueue/inline_-_sort_by_old_first.mdwn +++ b/doc/patchqueue/inline_-_sort_by_old_first.mdwn @@ -1,18 +1,29 @@ Quick hack to be able to list old entries first : ---- inline.pm 2007-01-18 18:21:27.000000000 +0100 -+++ /usr/share/perl5/IkiWiki/Plugin/inline.pm 2007-01-18 18:23:01.000000000 +0100 -@@ -92,6 +92,9 @@ - elsif (! exists $params{sort} || $params{sort} eq 'age') { - @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; - } -+ elsif (! exists $params{sort} || $params{sort} eq 'old') { -+ @list=sort { $pagectime{$a} <=> $pagectime{$b} } @list; -+ } - else { - return sprintf(gettext("unknown sort type %s"), $params{sort}); - } + + --- inline.pm 2007-01-18 18:21:27.000000000 +0100 + +++ /usr/share/perl5/IkiWiki/Plugin/inline.pm 2007-01-18 18:23:01.000000000 +0100 + @@ -92,6 +92,9 @@ + elsif (! exists $params{sort} || $params{sort} eq 'age') { + @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; + } + + elsif (! exists $params{sort} || $params{sort} eq 'old') { + + @list=sort { $pagectime{$a} <=> $pagectime{$b} } @list; + + } + else { + return sprintf(gettext("unknown sort type %s"), $params{sort}); + } + this patch adds a new type of sort "old". -However, I wonder if it would be better to add another option for inline like "sortorder" with "desc" or "asc" keywords ? \ No newline at end of file +> Hmm, take another look at your patch above. Comapre the added lines with +> the "age" lines just above them. It's identical; age already does what +> you want. --[[Joey]] + +>> Well, $b and $a are switched in 'old' comparing to 'age'... According to the documentation, *The default, "age" is to sort newest pages first*. I just want the reverse, and that's why I just switched the $a and $b args of the sort func.... --HB + +However, I wonder if it would be better to add another option for inline like "sortorder" with "desc" or "asc" keywords ? + +> That might be cleaner, since it would allow sorting pages in reverse by +> title. If someone ever had a reason to do that. --[[Joey]]