]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
po plugin: allow pagestate update (bugfix)
authorintrigeri <intrigeri@boum.org>
Fri, 10 Oct 2008 16:08:00 +0000 (18:08 +0200)
committerintrigeri <intrigeri@boum.org>
Sat, 18 Oct 2008 13:49:09 +0000 (15:49 +0200)
Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index d7f245e96ef65cdfd9086fb6d167ce5be4fe58ab..5042d264e82cdc4bc88d8f59a22c69a9bbb9e9ce 100644 (file)
@@ -14,6 +14,7 @@ use File::Temp;
 sub import {
        hook(type => "getsetup", id => "po", call => \&getsetup);
        hook(type => "checkconfig", id => "po", call => \&checkconfig);
+       hook(type => "needsbuild", id => "po", call => \&needsbuild);
        hook(type => "targetpage", id => "po", call => \&targetpage);
        hook(type => "tweakurlpath", id => "po", call => \&tweakurlpath);
        hook(type => "tweakbestlink", id => "po", call => \&tweakbestlink);
@@ -72,6 +73,22 @@ sub checkconfig () { #{{{
        }
 } #}}}
 
+sub needsbuild (@) { #{{{
+       my $needsbuild=shift;
+
+       foreach my $page (keys %pagestate) {
+               if (exists $pagestate{$page}{po}{translatable}) {
+                       if (exists $pagesources{$page} && 
+                           grep { $_ eq $pagesources{$page} } @$needsbuild) {
+                               # remove state, it will be re-added
+                               # if the preprocessor directive is still
+                               # there during the rebuild
+                               delete $pagestate{$page}{po}{translatable};
+                       }
+               }
+       }
+} #}}}
+
 sub targetpage (@) { #{{{
        my %params = @_;
         my $page=$params{page};