summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorhttp://ptecza.myopenid.com/ <http://ptecza.myopenid.com/@web>2008-09-02 04:23:59 -0400
committerJoey Hess <joey@kitenet.net>2008-09-02 04:23:59 -0400
commitff700576e342ac67bf575c4fa6220d5b051d1872 (patch)
tree4a71c960302f629ac6b73c7bd0016d1e0ed1d540 /doc
parentb66afd560ce0abee75322d006d21d9dbd90c4c72 (diff)
* Patch and 2 considerations for inline sorting
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/inline:_numerical_ordering_by_title.mdwn43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/todo/inline:_numerical_ordering_by_title.mdwn b/doc/todo/inline:_numerical_ordering_by_title.mdwn
index a023c7785..ecad4f9db 100644
--- a/doc/todo/inline:_numerical_ordering_by_title.mdwn
+++ b/doc/todo/inline:_numerical_ordering_by_title.mdwn
@@ -29,3 +29,46 @@ Do you have any idea how to workaround that issue? --[[Paweł|ptecza]]
>> 09.mdwn 100.mdwn 101.mdwn 102.mdwn 89.mdwn 90.mdwn
>> I don't want to rename all previous files to add `0` prefix. --[[Paweł|ptecza]]
+
+---
+
+Below is my simple patch. Feel free to use it or comment!
+
+I have also 2 considerations for inline sorting:
+
+1. Maybe changing name of `sort` parameter to `sortby` or `sortkey` will
+ be good idea?
+1. Maybe you should use `title` sort key for title from meta plugin and `name`,
+ `filename`, `page` or `pagename` for page names? In the future you can also
+ sort by meta author, license or another key.
+
+--[[Paweł|ptecza]]
+
+ --- inline.pm-orig 2008-09-02 09:53:20.000000000 +0200
+ +++ inline.pm 2008-09-02 10:09:02.000000000 +0200
+ @@ -186,7 +186,15 @@
+ }
+
+ if (exists $params{sort} && $params{sort} eq 'title') {
+ - @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
+ + if (! $params{sorttype} || $params{sorttype} eq 'lexical') {
+ + @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
+ + }
+ + elsif ($params{sorttype} eq 'numeric') {
+ + @list=sort { pagetitle(basename($a)) <=> pagetitle(basename($b)) } @list;
+ + }
+ + else {
+ + return sprintf(gettext("unknown sort type %s"), $params{sorttype});
+ + }
+ }
+ elsif (exists $params{sort} && $params{sort} eq 'mtime') {
+ @list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
+ @@ -195,7 +203,7 @@
+ @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
+ }
+ else {
+ - return sprintf(gettext("unknown sort type %s"), $params{sort});
+ + return sprintf(gettext("unknown sort key %s"), $params{sort});
+ }
+
+ if (yesno($params{reverse})) {