]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Revert "po: do not inject custom bestlink function when po_link_to eq default"
authorJoey Hess <joey@gnu.kitenet.net>
Sun, 30 Aug 2009 18:49:53 +0000 (14:49 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sun, 30 Aug 2009 18:50:43 +0000 (14:50 -0400)
This reverts commit cdc3576c8d1efb2593cac2d9da3f2393a2afe26e.

Conflicts:

IkiWiki/Plugin/po.pm

This change broke the test suite and is not strictly necessary.

IkiWiki/Plugin/po.pm
doc/plugins/po.mdwn

index 792d84261855ccd074421717207d0276cadc1928..5d0d9e79dd26074344a642f524d098101e4a21c8 100644 (file)
@@ -51,6 +51,8 @@ sub import {
        hook(type => "formbuilder_setup", id => "po", call => \&formbuilder_setup, last => 1);
        hook(type => "formbuilder", id => "po", call => \&formbuilder);
 
+       $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;
@@ -153,12 +155,6 @@ sub checkconfig () {
                warn(gettext('po_link_to=negotiated requires usedirs to be enabled, falling back to po_link_to=default'));
                $config{po_link_to}='default';
        }
-       unless ($config{po_link_to} eq 'default') {
-               if (! exists $origsubs{'bestlink'}) {
-                       $origsubs{'bestlink'}=\&IkiWiki::bestlink;
-                       inject(name => "IkiWiki::bestlink", call => \&mybestlink);
-               }
-       }
 
        push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
 
@@ -562,11 +558,13 @@ sub formbuilder (@) {
 # `----
 
 # Implement po_link_to 'current' and 'negotiated' settings.
-# Not injected otherwise.
 sub mybestlink ($$) {
        my $page=shift;
        my $link=shift;
 
+       return $origsubs{'bestlink'}->($page, $link)
+               if $config{po_link_to} eq "default";
+
        my $res=$origsubs{'bestlink'}->(masterpage($page), $link);
        my @caller = caller(1);
        if (length $res
index 9f4cf5564f44292f5df18e2e595529ed3fd8d800..38b6b12cdefdd80c897baaaf05e794bc5ef27d08 100644 (file)
@@ -337,6 +337,8 @@ soon..) --[[Joey]]
 > environment at the start of these parts... which I did not manage to
 > achieve in the last 2 hours :/ --[[intrigeri]]
 
+>> I've reverted it. --[[Joey]] 
+
 Documentation
 -------------