]> sipb.mit.edu Git - ikiwiki.git/commitdiff
po(delete): added hook, and function skeleton
authorintrigeri <intrigeri@boum.org>
Thu, 13 Nov 2008 00:38:22 +0000 (01:38 +0100)
committerintrigeri <intrigeri@boum.org>
Thu, 13 Nov 2008 00:38:22 +0000 (01:38 +0100)
Not implemented yet, 'cos the renamepage hook has to come first.
Else translations would be deleted on rename, what a shame.

Signed-off-by: intrigeri <intrigeri@boum.org>
IkiWiki/Plugin/po.pm

index d92443b18cb7ef810daba89dea8e7add7babde92..60a9f26322cdb34dae9f71e1148eb47f158ee7a0 100644 (file)
@@ -35,6 +35,7 @@ sub import { #{{{
        hook(type => "filter", id => "po", call => \&filter);
        hook(type => "htmlize", id => "po", call => \&htmlize);
        hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
+       hook(type => "delete", id => "po", call => \&mydelete);
        hook(type => "change", id => "po", call => \&change);
        hook(type => "editcontent", id => "po", call => \&editcontent);
 
@@ -325,6 +326,12 @@ sub pagetemplate (@) { #{{{
        }
 } # }}}
 
+sub mydelete(@) { #{{{
+       my @deleted=@_;
+
+       map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
+} #}}}
+
 sub change(@) { #{{{
        my @rendered=@_;
 
@@ -757,6 +764,13 @@ sub homepageurl (;$) { #{{{
        return urlto('', $page);
 } #}}}
 
+# do *not* implement this until the renamepage hook works
+sub deletetranslations ($) { #{{{
+       my $file=shift;
+
+       debug 'po(deletetranslations): TODO: delete translations of ' . $file;
+} #}}}
+
 # ,----
 # | PageSpec's
 # `----