From d877b9644bcfbbfc5eaf3f7fc13cb96ecda946c9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 25 Jun 2010 17:14:13 +0200 Subject: [PATCH] po: fix bug with translated pages including templates The protection against processing loops (i.e. the alreadyfiltered stuff) was playing against us: the template plugin triggered a filter hooks run with the very same ($page, $destpage) arguments pair that we use to identify a already filtered page. Processing an included template could then mark the whole translation page as already filtered, which prevented po_to_markup to be called on the PO content. This commit only runs the whole PO filter logic when our filter hook is run by IkiWiki::render, which only happens when the full page needs to be filtered. --- IkiWiki/Plugin/po.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 3023fd7f9..0b48726ea 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -243,6 +243,10 @@ sub filter (@) { my $page = $params{page}; my $destpage = $params{destpage}; my $content = $params{content}; + + my @caller = caller(4); + return $content unless $caller[3] ne "IkiWiki::render"; + if (istranslation($page) && ! alreadyfiltered($page, $destpage)) { $content = po_to_markup($page, $content); setalreadyfiltered($page, $destpage); -- 2.26.2