summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-06 17:28:04 +0100
committerintrigeri <intrigeri@boum.org>2008-11-06 17:28:04 +0100
commitdaa04ae43612f2c48c6ec3e1c5dfa0ee6fda6653 (patch)
tree380bec59371d2976180d5cded7402745176690be /IkiWiki
parent8b001dbb00d702fad648c0f313b0d1d6a3827325 (diff)
po: fix link to homepage in special case
... by wrapping IkiWiki::urlto in order to workaround hard-coded /index.$config{htmlext}, which is wrong when usedirs=0 and po_link_to=current and translatable homepage Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index c8ec37c22..7902fa745 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -48,6 +48,8 @@ sub import { #{{{
inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
$origsubs{'targetpage'}=\&IkiWiki::targetpage;
inject(name => "IkiWiki::targetpage", call => \&mytargetpage);
+ $origsubs{'urlto'}=\&IkiWiki::urlto;
+ inject(name => "IkiWiki::urlto", call => \&myurlto);
} #}}}
sub getsetup () { #{{{
@@ -256,6 +258,21 @@ sub urlto_with_orig_beautiful_urlpath($$) { #{{{
return $res;
} #}}}
+sub myurlto ($$;$) { #{{{
+ my $to=shift;
+ my $from=shift;
+ my $absolute=shift;
+
+ if (! length $to
+ && $config{po_link_to} eq "current"
+ && istranslation($from)
+ && istranslatable('index')) {
+ my ($masterpage, $curlang) = ($from =~ /(.*)[.]([a-z]{2})$/);
+ return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . $curlang . ".$config{htmlext}");
+ }
+ return $origsubs{'urlto'}->($to,$from,$absolute);
+} #}}}
+
sub mybestlink ($$) { #{{{
my $page=shift;
my $link=shift;