summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorchrysn <chrysn@fsfe.org>2009-03-17 20:19:11 +0100
committerJoey Hess <joey@gnu.kitenet.net>2009-03-19 15:31:46 -0400
commit55b83cb7bd1cd7c60bb45dc22c3745dd80a63fed (patch)
tree44df56ffe83969e67a8e6aa9987eab9c390d6a64 /IkiWiki
parent888e67bf4e44b66dcecde07395a50135e19b911d (diff)
implement sort=title_natural for inline
adds a new sorting order, title_natural, that uses Sort::Naturally's ncmp function to provide better sorting for inlines
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 2205ebffc..a89e827c1 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -194,6 +194,10 @@ sub preprocess_inline (@) {
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 'title_natural') {
+ require Sort::Naturally;
+ @list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
+ }
elsif (exists $params{sort} && $params{sort} eq 'mtime') {
@list=sort { $pagemtime{$b} <=> $pagemtime{$a} } @list;
}