]> sipb.mit.edu Git - ikiwiki.git/commitdiff
backup refs to injected subs later
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 5 Nov 2008 20:09:54 +0000 (15:09 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 5 Nov 2008 20:09:54 +0000 (15:09 -0500)
In case two plugins both inject replacements for these subs,
backup the ref just before injecting to make sure the most
recent version is seen.

IkiWiki/Plugin/po.pm

index 4bac376561139cbf6077276b9e89a7198c2201ca..466ffd0b8341ea51d93583ab7d85ba1badd760c9 100644 (file)
@@ -27,9 +27,6 @@ memoize("percenttranslated");
 
 # backup references to subs that will be overriden
 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);
@@ -38,8 +35,12 @@ sub import { #{{{
        hook(type => "filter", id => "po", call => \&filter);
        hook(type => "htmlize", id => "po", call => \&htmlize);
        hook(type => "pagetemplate", id => "po", call => \&pagetemplate);
+
+       $origsubs{'bestlink'}=\&IkiWiki::bestlink;
        inject(name => "IkiWiki::bestlink", call => \&mybestlink);
+       $origsubs{'beautify_urlpath'}=\&IkiWiki::beautify_urlpath;
        inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
+       $origsubs{'targetpage'}=\&IkiWiki::targetpage;
        inject(name => "IkiWiki::targetpage", call => \&mytargetpage);
 } #}}}