]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/sortnaturally.pm
fix example
[git.ikiwiki.info.git] / IkiWiki / Plugin / sortnaturally.pm
index f498820a5bc7fa6107d4f182ef498641776262d7..108b489f80d6f7e71916c891345ecea8569e9ed3 100644 (file)
@@ -7,13 +7,14 @@ no warnings;
 
 sub import {
        hook(type => "getsetup", id => "sortnaturally", call => \&getsetup);
+       hook(type => "checkconfig", id => "sortnaturally", call => \&checkconfig);
 }
 
 sub getsetup {
        return
                plugin => {
                        safe => 1,
-                       rebuild => 1,
+                       rebuild => undef,
                },
 }
 
@@ -25,8 +26,13 @@ sub checkconfig () {
 package IkiWiki::SortSpec;
 
 sub cmp_title_natural {
-       Sort::Naturally::ncmp(IkiWiki::pagetitle(IkiWiki::basename($_[0])),
-               IkiWiki::pagetitle(IkiWiki::basename($_[1])))
+       Sort::Naturally::ncmp(IkiWiki::pagetitle(IkiWiki::basename($a)),
+               IkiWiki::pagetitle(IkiWiki::basename($b)))
+}
+
+sub cmp_path_natural {
+       Sort::Naturally::ncmp(IkiWiki::pagetitle($a),
+               IkiWiki::pagetitle($b))
 }
 
 1;