diff options
author | Simon McVittie <smcv@debian.org> | 2010-04-03 13:57:38 +0100 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2010-04-03 14:28:21 +0100 |
commit | 04a59b3c65e8e60805b6ed6d11d448b1d5babe64 (patch) | |
tree | 3bd1565e918b1944a18b641f70af48ffc28a2e06 /IkiWiki.pm | |
parent | 75fd08046548940c443c46bcdf9a5b0b6968b175 (diff) | |
download | ikiwiki-04a59b3c65e8e60805b6ed6d11d448b1d5babe64.tar ikiwiki-04a59b3c65e8e60805b6ed6d11d448b1d5babe64.tar.gz |
Move sort hooks to the IkiWiki::SortSpec namespace
Also rename cmpspec_translate (internal function) to sortspec_translate
for consistency.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 7547f1751..d716e8b39 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -37,7 +37,7 @@ our $DEPEND_LINKS=4; # Optimisation. use Memoize; memoize("abs2rel"); -memoize("cmpspec_translate"); +memoize("sortspec_translate"); memoize("pagespec_translate"); memoize("template_file"); @@ -1935,7 +1935,7 @@ sub add_link ($$) { unless grep { $_ eq $link } @{$links{$page}}; } -sub cmpspec_translate ($) { +sub sortspec_translate ($) { my $spec = shift; my $code = ""; @@ -1972,13 +1972,13 @@ sub cmpspec_translate ($) { $code .= "-"; } - if (exists $IkiWiki::PageSpec::{"cmp_$word"}) { + if (exists $IkiWiki::SortSpec::{"cmp_$word"}) { if (defined $params) { push @data, $params; - $code .= "IkiWiki::PageSpec::cmp_$word(\@_, \$data[$#data])"; + $code .= "IkiWiki::SortSpec::cmp_$word(\@_, \$data[$#data])"; } else { - $code .= "IkiWiki::PageSpec::cmp_$word(\@_, undef)"; + $code .= "IkiWiki::SortSpec::cmp_$word(\@_, undef)"; } } else { @@ -2095,7 +2095,7 @@ sub pagespec_match_list ($$;@) { } if (defined $params{sort}) { - my $f = cmpspec_translate($params{sort}); + my $f = sortspec_translate($params{sort}); @candidates = sort { $f->($a, $b) } @candidates; } @@ -2410,6 +2410,8 @@ sub match_ip ($$;@) { } } +package IkiWiki::SortSpec; + sub cmp_title { IkiWiki::pagetitle(IkiWiki::basename($_[0])) cmp |