summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-04 20:05:21 +0100
committerintrigeri <intrigeri@boum.org>2008-11-04 20:05:21 +0100
commitbc5b875de85419d38688b47e0d40ff808f0ebd86 (patch)
tree2d90482c213c3a5d14440cd2f82f5bb9848131a9 /IkiWiki
parent61c4129aaaa5ce1849023aa9f12f32ff98eb52fb (diff)
po plugin: remove broken parentlinks for home page's translations
Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index cc8e9b2ed..a5bf4fb54 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -38,7 +38,7 @@ sub import {
hook(type => "needsbuild", id => "po", call => \&needsbuild);
hook(type => "filter", id => "po", call => \&filter);
hook(type => "htmlize", id => "po", call => \&htmlize);
- hook(type => "pagetemplate", id => "po", call => \&pagetemplate);
+ hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
hook(type => "editcontent", id => "po", call => \&editcontent);
inject(name => "IkiWiki::bestlink", call => \&mybestlink);
inject(name => "IkiWiki::beautify_urlpath", call => \&mybeautify_urlpath);
@@ -398,9 +398,10 @@ sub otherlanguages ($) { #{{{
sub pagetemplate (@) { #{{{
my %params=@_;
- my $page=$params{page};
- my $destpage=$params{destpage};
- my $template=$params{template};
+ my $page=$params{page};
+ my $destpage=$params{destpage};
+ my $template=$params{template};
+ my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/) if istranslation($page);
if (istranslation($page) && $template->query(name => "percenttranslated")) {
$template->param(percenttranslated => percenttranslated($page));
@@ -419,7 +420,6 @@ sub pagetemplate (@) { #{{{
}
}
elsif (istranslation($page)) {
- my ($masterpage, $curlang) = ($page =~ /(.*)[.]([a-z]{2})$/);
add_depends($page, $masterpage);
foreach my $translation (values %{$translations{$masterpage}}) {
add_depends($page, $translation);
@@ -434,7 +434,6 @@ sub pagetemplate (@) { #{{{
# prevent future breakage when ikiwiki internals change.
# Known limitations are preferred to future random bugs.
if ($template->param('discussionlink') && istranslation($page)) {
- my ($masterpage, $lang) = ($page =~ /(.*)[.]([a-z]{2})$/);
$template->param('discussionlink' => htmllink(
$page,
$destpage,
@@ -444,6 +443,12 @@ sub pagetemplate (@) { #{{{
linktext => gettext("Discussion"),
));
}
+ # remove broken parentlink to ./index.html on home page's translations
+ if ($template->param('parentlinks')
+ && istranslation($page)
+ && $masterpage eq "index") {
+ $template->param('parentlinks' => []);
+ }
} # }}}
sub editcontent () { #{{{