]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Plugin/sortnaturally.pm
moved non-openid signin form into same page as openid selector; show/hide as buttons...
[ikiwiki.git] / IkiWiki / Plugin / sortnaturally.pm
1 #!/usr/bin/perl
2 # Sort::Naturally-powered title_natural sort order for IkiWiki
3 package IkiWiki::Plugin::sortnaturally;
4
5 use IkiWiki 3.00;
6 no warnings;
7
8 sub import {
9         hook(type => "getsetup", id => "sortnaturally", call => \&getsetup);
10 }
11
12 sub getsetup {
13         return
14                 plugin => {
15                         safe => 1,
16                         rebuild => undef,
17                 },
18 }
19
20 sub checkconfig () {
21         eval q{use Sort::Naturally};
22         error $@ if $@;
23 }
24
25 package IkiWiki::SortSpec;
26
27 sub cmp_title_natural {
28         Sort::Naturally::ncmp(IkiWiki::pagetitle(IkiWiki::basename($a)),
29                 IkiWiki::pagetitle(IkiWiki::basename($b)))
30 }
31
32 1;