* inline: Add ability to sort by page name, based on a patch from
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 25 Sep 2006 21:13:14 +0000 (21:13 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 25 Sep 2006 21:13:14 +0000 (21:13 +0000)
    Benjamin A'Lee.

IkiWiki/Plugin/inline.pm
debian/changelog
doc/plugins/inline.mdwn

index 79e64beac72a16fd5019d23eac3614ea848afbbf..868f3816fa6d7e21bcdaed64b28042e3205e866c 100644 (file)
@@ -59,7 +59,17 @@ sub preprocess_inline (@) { #{{{
                        push @list, $page;
                }
        }
-       @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
+
+       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;
+       }
+       else {
+               return "unknown sort type $params{sort}";
+       }
+
        if ($params{show} && @list > $params{show}) {
                @list=@list[0..$params{show} - 1];
        }
index 57ee09bf513645c30eafdd3b4234f1f9d26d49b6..a4f06fa64eba12d984d663203571e92b79effffd 100644 (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
 
   * Work on firming up the plugin interface:
index 05dea3a705d167b971d6e9821281a44d3d31df30..ef08d2cb23c5079d72ee6bb6c463cef164aaf895 100644 (file)
@@ -32,3 +32,5 @@ directive:
 * `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
   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.