po plugin: update injected urlto signature.

The lack of $from will probably hurt setups using po_link_to = current,
but at least we can fix the blocker bug that prevents any wiki using the po
plugin to build.
master
intrigeri 2010-12-20 14:36:21 +01:00
parent 75196e76b6
commit 74055be78f
1 changed files with 7 additions and 2 deletions

View File

@ -635,7 +635,7 @@ sub mytargetpage ($$) {
return $origsubs{'targetpage'}->($page, $ext); return $origsubs{'targetpage'}->($page, $ext);
} }
sub myurlto ($$;$) { sub myurlto ($;$$) {
my $to=shift; my $to=shift;
my $from=shift; my $from=shift;
my $absolute=shift; my $absolute=shift;
@ -644,8 +644,13 @@ sub myurlto ($$;$) {
if (! length $to if (! length $to
&& $config{po_link_to} eq "current" && $config{po_link_to} eq "current"
&& istranslatable('index')) { && istranslatable('index')) {
if (defined $from) {
return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}"); return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}");
} }
else {
return $origsubs{'urlto'}->($to,$from,$absolute);
}
}
# avoid using our injected beautify_urlpath if run by cgi_editpage, # avoid using our injected beautify_urlpath if run by cgi_editpage,
# so that one is redirected to the just-edited page rather than to the # so that one is redirected to the just-edited page rather than to the
# negociated translation; to prevent unnecessary fiddling with caller/inject, # negociated translation; to prevent unnecessary fiddling with caller/inject,