]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/sortnaturally.pm
Added a rescan hook.
[git.ikiwiki.info.git] / IkiWiki / Plugin / sortnaturally.pm
1 #!/usr/bin/perl
2 # Sort::Naturally-powered title_natural sort order for IkiWiki
3 package IkiWiki::Plugin::sortnaturally;
5 use IkiWiki 3.00;
6 no warnings;
8 sub import {
9         hook(type => "getsetup", id => "sortnaturally", call => \&getsetup);
10 }
12 sub getsetup {
13         return
14                 plugin => {
15                         safe => 1,
16                         rebuild => undef,
17                 },
18 }
20 sub checkconfig () {
21         eval q{use Sort::Naturally};
22         error $@ if $@;
23 }
25 package IkiWiki::SortSpec;
27 sub cmp_title_natural {
28         Sort::Naturally::ncmp(IkiWiki::pagetitle(IkiWiki::basename($a)),
29                 IkiWiki::pagetitle(IkiWiki::basename($b)))
30 }
32 1;