From: joey Date: Mon, 25 Sep 2006 21:13:14 +0000 (+0000) Subject: * inline: Add ability to sort by page name, based on a patch from X-Git-Tag: 1.28~3 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/48e004acb1cd8d09dfa52377bd48edaee293bc9f * inline: Add ability to sort by page name, based on a patch from Benjamin A'Lee. --- diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 79e64beac..868f3816f 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -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]; } diff --git a/debian/changelog b/debian/changelog index 57ee09bf5..a4f06fa64 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Mon, 25 Sep 2006 17:06:39 -0400 + ikiwiki (1.27) unstable; urgency=low * Work on firming up the plugin interface: diff --git a/doc/plugins/inline.mdwn b/doc/plugins/inline.mdwn index 05dea3a70..ef08d2cb2 100644 --- a/doc/plugins/inline.mdwn +++ b/doc/plugins/inline.mdwn @@ -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.