]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
inline: pass the Atom/RSS titles to the templates
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index d920d36486a7aa88dfbafc5d8bcbcd1049827812..9ed4a1adb8352f5bb91eb25a424d9cc5f1e1e212 100644 (file)
@@ -152,7 +152,7 @@ sub checkconfig () {
        if (ref $config{po_slave_languages} eq 'ARRAY') {
                foreach my $pair (@{$config{po_slave_languages}}) {
                        my ($code, $name)=splitlangpair($pair);
-                       if (defined $code) {
+                       if (defined $code && ! exists $slavelanguages{$code}) {
                                push @slavelanguages, $code;
                                $slavelanguages{$code} = $name;
                        }
@@ -367,7 +367,8 @@ sub pagetemplate (@) {
            && $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});
        }
 }
@@ -635,7 +636,7 @@ sub mytargetpage ($$) {
        return $origsubs{'targetpage'}->($page, $ext);
 }
 
-sub myurlto ($$;$) {
+sub myurlto ($;$$) {
        my $to=shift;
        my $from=shift;
        my $absolute=shift;
@@ -644,7 +645,12 @@ sub myurlto ($$;$) {
        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
@@ -1249,8 +1255,8 @@ sub splitlangpair ($) {
        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;
@@ -1297,7 +1303,7 @@ sub match_lang ($$;@) {
 
        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 {