]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/po.pm
Merge remote branch 'upstream/master' into prv/po
[ikiwiki.git] / IkiWiki / Plugin / po.pm
index a79e7d7f0ee56f579ff4e261cd97028533de3099..a142bb90961f108b2f9b395d69eba26a6b7a394f 100644 (file)
@@ -635,7 +635,7 @@ sub mytargetpage ($$) {
        return $origsubs{'targetpage'}->($page, $ext);
 }
 
-sub myurlto ($$;$) {
+sub myurlto ($;$$) {
        my $to=shift;
        my $from=shift;
        my $absolute=shift;
@@ -644,7 +644,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
@@ -1297,7 +1302,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 {