From 950c29679df8f8f2f20e150896dc7ec686f123e8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 2 Nov 2008 18:48:56 +0100 Subject: po plugin: replace targetpage hook with wrapper function Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 9b5652561..127d6d47f 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -29,18 +29,19 @@ memoize("percenttranslated"); my %origsubs; $origsubs{'bestlink'}=\&IkiWiki::bestlink; $origsubs{'beautify_urlpath'}=\&IkiWiki::beautify_urlpath; +$origsubs{'targetpage'}=\&IkiWiki::targetpage; sub import { hook(type => "getsetup", id => "po", call => \&getsetup); hook(type => "checkconfig", id => "po", call => \&checkconfig); hook(type => "needsbuild", id => "po", call => \&needsbuild); - hook(type => "targetpage", id => "po", call => \&targetpage); hook(type => "tweakurlpath", id => "po", call => \&tweakurlpath); hook(type => "filter", id => "po", call => \&filter); hook(type => "htmlize", id => "po", call => \&htmlize); hook(type => "pagetemplate", id => "po", call => \&pagetemplate); inject(name => "IkiWiki::bestlink", call => \&mybestlink); inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath); + inject(name => "IkiWiki::targetpage", call => \&mytargetpage); } sub getsetup () { #{{{ @@ -219,10 +220,9 @@ sub needsbuild () { #{{{ } } #}}} -sub targetpage (@) { #{{{ - my %params = @_; - my $page=$params{page}; - my $ext=$params{ext}; +sub mytargetpage ($$) { #{{{ + my $page=shift; + my $ext=shift; if (istranslation($page)) { my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/); @@ -241,7 +241,7 @@ sub targetpage (@) { #{{{ return $page . "/index." . $config{po_master_language}{code} . "." . $ext; } } - return; + return $origsubs{'targetpage'}->($page, $ext); } #}}} sub mybeautify_urlpath ($) { #{{{ -- cgit v1.2.3