summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-10 15:30:49 +0100
committerintrigeri <intrigeri@boum.org>2008-11-10 15:30:49 +0100
commit1255acc02c7e0273e988c1cbbd1c1accc134c2bc (patch)
tree059db22e6d9fa2f7cc7e8fc3b454826c9805a400 /IkiWiki
parent38cdda66d7d318918aab13b5e3b8dbfebc9ffd1c (diff)
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 <intrigeri@boum.org>
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm51
1 files 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.