sub import {
hook(type => "getsetup", id => "po", call => \&getsetup);
- hook(type => "checkconfig", id => "po", call => \&checkconfig);
+ hook(type => "checkconfig", id => "po", call => \&checkconfig,
+ last => 1);
hook(type => "needsbuild", id => "po", call => \&needsbuild);
hook(type => "scan", id => "po", call => \&scan, last => 1);
hook(type => "filter", id => "po", call => \&filter);
&& $masterpage eq "index") {
$template->param('parentlinks' => []);
}
- if (ishomepage($page) && $template->query(name => "title")) {
+ if (ishomepage($page) && $template->query(name => "title")
+ && !$template->param("title_overridden")) {
$template->param(title => $config{wikiname});
}
}
return $origsubs{'targetpage'}->($page, $ext);
}
-sub myurlto ($$;$) {
+sub myurlto ($;$$) {
my $to=shift;
my $from=shift;
my $absolute=shift;
if (! length $to
&& $config{po_link_to} eq "current"
&& istranslatable('index')) {
- return IkiWiki::beautify_urlpath(IkiWiki::baseurl($from) . "index." . lang($from) . ".$config{htmlext}");
+ if (defined $from) {
+ 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,
# so that one is redirected to the just-edited page rather than to the
if (! defined $code || ! defined $name ||
! length $code || ! length $name) {
# not a fatal error to avoid breaking if used with web setup
- print STDERR sprintf(gettext("%s has invalid syntax: must use CODE|NAME"),
- $pair)."\n";
+ warn sprintf(gettext("%s has invalid syntax: must use CODE|NAME"),
+ $pair);
}
return $code, $name;
my $regexp=IkiWiki::glob2re($wanted);
my $lang=IkiWiki::Plugin::po::lang($page);
- if ($lang !~ /^$regexp$/i) {
+ if ($lang !~ $regexp) {
return IkiWiki::FailReason->new("file language is $lang, not $wanted");
}
else {