<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# Sort::Naturally-powered title_natural sort order for IkiWiki
package IkiWiki::Plugin::sortnaturally;

use IkiWiki 3.00;
no warnings;

sub import {
	hook(type =&gt; "getsetup", id =&gt; "sortnaturally", call =&gt; \&amp;getsetup);
	hook(type =&gt; "checkconfig", id =&gt; "sortnaturally", call =&gt; \&amp;checkconfig);
}

sub getsetup {
	return
		plugin =&gt; {
			safe =&gt; 1,
			rebuild =&gt; undef,
		},
}

sub checkconfig () {
	eval q{use Sort::Naturally};
	error $@ if $@;
}

package IkiWiki::SortSpec;

sub cmp_title_natural {
	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;
</pre></body></html>