From c390056eb2b99bcc3a528611f5a9fde79ea364cf Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 13 Nov 2008 01:38:22 +0100 Subject: [PATCH] po(delete): added hook, and function skeleton 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 --- IkiWiki/Plugin/po.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index d92443b18..60a9f2632 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -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 # `---- -- 2.44.0