X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/6b82ef44b07d19cd17dad3c26fe0a05715ffcb03..f0abaa9fc99463e403fa3b700bd005bcfaa75c6d:/IkiWiki/Plugin/po.pm?ds=inline diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 164d35270..96ba467c5 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -285,6 +285,9 @@ sub pagetemplate (@) { #{{{ if ($template->query(name => "istranslatable")) { $template->param(istranslatable => istranslatable($page)); } + if ($template->query(name => "HOMEPAGEURL")) { + $template->param(homepageurl => homepageurl($page)); + } if ($template->query(name => "otherlanguages")) { $template->param(otherlanguages => [otherlanguagesloop($page)]); map add_depends($page, $_), (values %{otherlanguages($page)}); @@ -359,6 +362,10 @@ sub change(@) { #{{{ resettranslationscache(); # Trigger a wiki refresh. require IkiWiki::Render; + # without preliminary saveindex/loadindex, refresh() + # complains about a lot of uninitialized variables + IkiWiki::saveindex(); + IkiWiki::loadindex(); IkiWiki::refresh(); IkiWiki::saveindex(); } @@ -399,6 +406,7 @@ sub mybeautify_urlpath ($) { #{{{ my $res=$origsubs{'beautify_urlpath'}->($url); if ($config{po_link_to} eq "negotiated") { $res =~ s!/\Qindex.$config{po_master_language}{code}.$config{htmlext}\E$!/!; + $res =~ s!/\Qindex.$config{htmlext}\E$!/!; } return $res; } #}}} @@ -427,7 +435,6 @@ sub myurlto ($$;$) { #{{{ # workaround hard-coded /index.$config{htmlext} in IkiWiki::urlto() if (! length $to && $config{po_link_to} eq "current" - && istranslation($from) && istranslatable('index')) { return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}"); } @@ -706,6 +713,11 @@ sub otherlanguagesloop ($) { #{{{ } @ret; } #}}} +sub homepageurl (;$) { #{{{ + my $page=shift; + + return urlto('', $page); +} #}}} # ,---- # | PageSpec's