From: Joey Hess Date: Fri, 28 Aug 2009 23:48:32 +0000 (-0400) Subject: Merge commit 'intrigeri/po' X-Git-Tag: 3.1415926~10 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/3811c5f5599f63a65d9b0c73451201514082e8ec?hp=-c Merge commit 'intrigeri/po' --- 3811c5f5599f63a65d9b0c73451201514082e8ec diff --combined IkiWiki/Plugin/inline.pm index d5ad11d43,c9cbb9cb7..ccfadfd69 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@@ -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}); @@@ -247,6 -247,7 +247,6 @@@ @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. @@@ -306,17 -307,7 +306,7 @@@ # 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 cde2ad4e3,21e3b8e37..792d84261 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@@ -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 # `----