From 1255acc02c7e0273e988c1cbbd1c1accc134c2bc Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 10 Nov 2008 15:30:49 +0100 Subject: [PATCH] po: finish abstracting %filtered by putting it into a blackbox i.e. it is invisible for everyone but its accessors/mutators Signed-off-by: intrigeri --- IkiWiki/Plugin/po.pm | 51 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index 8ea852d04..0666142cb 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -21,7 +21,6 @@ use UNIVERSAL; my %translations; my @origneedsbuild; -our %filtered; memoize("_istranslation"); memoize("percenttranslated"); @@ -359,30 +358,38 @@ sub mybestlink ($$) { #{{{ return ""; } #}}} -sub alreadyfiltered($$) { #{{{ - my $page=shift; - my $destpage=shift; +# blackbox for %filtered +{ + my %filtered; - return ( exists $filtered{$page}{$destpage} - && $filtered{$page}{$destpage} eq 1 ); -} #}}} -sub setalreadyfiltered($$) { #{{{ - my $page=shift; - my $destpage=shift; + sub alreadyfiltered($$) { #{{{ + my $page=shift; + my $destpage=shift; - $filtered{$page}{$destpage}=1; -} #}}} -sub unsetalreadyfiltered($$) { #{{{ - my $page=shift; - my $destpage=shift; + return ( exists $filtered{$page}{$destpage} + && $filtered{$page}{$destpage} eq 1 ); + } #}}} - if (exists $filtered{$page}{$destpage}) { - delete $filtered{$page}{$destpage}; - } -} #}}} -sub resetalreadyfiltered() { #{{{ - undef %filtered; -} #}}} + sub setalreadyfiltered($$) { #{{{ + my $page=shift; + my $destpage=shift; + + $filtered{$page}{$destpage}=1; + } #}}} + + sub unsetalreadyfiltered($$) { #{{{ + my $page=shift; + my $destpage=shift; + + if (exists $filtered{$page}{$destpage}) { + delete $filtered{$page}{$destpage}; + } + } #}}} + + sub resetalreadyfiltered() { #{{{ + undef %filtered; + } #}}} +} # We use filter to convert PO to the master page's format, # since the rest of ikiwiki should not work on PO files. -- 2.39.5