]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge commit 'intrigeri/po'
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 28 Aug 2009 23:48:32 +0000 (19:48 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 28 Aug 2009 23:48:32 +0000 (19:48 -0400)
1  2 
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/po.pm

diff --combined IkiWiki/Plugin/inline.pm
index d5ad11d438ce2b4b43a9d913cdf489ec0d34e779,c9cbb9cb7112f2384a1f5e30016ae592009f571c..ccfadfd699929a8be1764546118d89ee9f958f56
@@@ -195,10 -195,10 +195,10 @@@ sub preprocess_inline (@) 
  
                @list = map { bestlink($params{page}, $_) }
                        split ' ', $params{pagenames};
 -
 -              $params{pages} = join(" or ", @list);
        }
        else {
 +              add_depends($params{page}, $params{pages});
 +
                @list = pagespec_match_list(
                        [ grep { $_ ne $params{page} } keys %pagesources ],
                        $params{pages}, location => $params{page});
                @list=@list[0..$params{show} - 1];
        }
  
 -      add_depends($params{page}, $params{pages});
        # Explicitly add all currently displayed pages as dependencies, so
        # that if they are removed or otherwise changed, the inline will be
        # sure to be updated.
                # Add a blog post form, with feed buttons.
                my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
                $formtemplate->param(cgiurl => $config{cgiurl});
-               my $rootpage;
-               if (exists $params{rootpage}) {
-                       $rootpage=bestlink($params{page}, $params{rootpage});
-                       if (!length $rootpage) {
-                               $rootpage=$params{rootpage};
-                       }
-               }
-               else {
-                       $rootpage=$params{page};
-               }
-               $formtemplate->param(rootpage => $rootpage);
+               $formtemplate->param(rootpage => rootpage(%params));
                $formtemplate->param(rssurl => $rssurl) if $feeds && $rss;
                $formtemplate->param(atomurl => $atomurl) if $feeds && $atom;
                if (exists $params{postformtext}) {
@@@ -653,4 -644,21 +643,21 @@@ sub pingurl (@) 
        exit 0; # daemon done
  }
  
+ sub rootpage (@) {
+       my %params=@_;
+       my $rootpage;
+       if (exists $params{rootpage}) {
+               $rootpage=bestlink($params{page}, $params{rootpage});
+               if (!length $rootpage) {
+                       $rootpage=$params{rootpage};
+               }
+       }
+       else {
+               $rootpage=$params{page};
+       }
+       return $rootpage;
+ }
  1
diff --combined IkiWiki/Plugin/po.pm
index cde2ad4e3a7c4333285584c324525b754fe9d8c8,21e3b8e3766bfc0cb42c9317d08b7212f4147607..792d84261855ccd074421717207d0276cadc1928
@@@ -59,6 -59,8 +59,8 @@@ sub import 
        inject(name => "IkiWiki::urlto", call => \&myurlto);
        $origsubs{'cgiurl'}=\&IkiWiki::cgiurl;
        inject(name => "IkiWiki::cgiurl", call => \&mycgiurl);
+       $origsubs{'rootpage'}=\&IkiWiki::rootpage;
+       inject(name => "IkiWiki::rootpage", call => \&myrootpage);
  }
  
  
@@@ -152,10 -154,8 +154,10 @@@ sub checkconfig () 
                $config{po_link_to}='default';
        }
        unless ($config{po_link_to} eq 'default') {
 -              $origsubs{'bestlink'}=\&IkiWiki::bestlink;
 -              inject(name => "IkiWiki::bestlink", call => \&mybestlink);
 +              if (! exists $origsubs{'bestlink'}) {
 +                      $origsubs{'bestlink'}=\&IkiWiki::bestlink;
 +                      inject(name => "IkiWiki::bestlink", call => \&mybestlink);
 +              }
        }
  
        push @{$config{wiki_file_prune_regexps}}, qr/\.pot$/;
@@@ -566,9 -566,12 +568,12 @@@ sub mybestlink ($$) 
        my $link=shift;
  
        my $res=$origsubs{'bestlink'}->(masterpage($page), $link);
+       my @caller = caller(1);
        if (length $res
            && istranslatable($res)
-           && istranslation($page)) {
+           && istranslation($page)
+           &&  !(exists $caller[3] && defined $caller[3]
+                 && ($caller[3] eq "IkiWiki::PageSpec::match_link"))) {
                return $res . "." . lang($page);
        }
        return $res;
@@@ -651,6 -654,22 +656,22 @@@ sub mycgiurl (@) 
        return $origsubs{'cgiurl'}->(%params);
  }
  
+ sub myrootpage (@) {
+       my %params=@_;
+       my $rootpage;
+       if (exists $params{rootpage}) {
+               $rootpage=$origsubs{'bestlink'}->($params{page}, $params{rootpage});
+               if (!length $rootpage) {
+                       $rootpage=$params{rootpage};
+               }
+       }
+       else {
+               $rootpage=masterpage($params{page});
+       }
+       return $rootpage;
+ }
  # ,----
  # | Blackboxes for private data
  # `----