From 47cec07e4441a06bb741910a329215d4d6ad0a86 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 2 May 2006 15:22:49 +0000 Subject: ah, the joys of test-based development.. think I have smart glob list matching working ok --- IkiWiki/Render.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 35e279a68..be6e6d1cb 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -158,10 +158,31 @@ sub add_depends ($$) { #{{{ $depends{$page}=$globlist; } else { - $depends{$page}.=" ".$globlist; + $depends{$page}=globlist_merge($depends{$page}, $globlist); } } # }}} +sub globlist_merge ($$) { #{{{ + my $a=shift; + my $b=shift; + + my $ret=""; + # Only add negated globs if they are not matched by the other globlist. + foreach my $i ((map { [ $a, $_ ] } split(" ", $b)), + (map { [ $b, $_ ] } split(" ", $a))) { + if ($i->[1]=~/^!(.*)/) { + if (! globlist_match($1, $i->[0])) { + $ret.=" ".$i->[1]; + } + } + else { + $ret.=" ".$i->[1]; + } + } + + return $ret; +} #}}} + sub genpage ($$$) { #{{{ my $content=shift; my $page=shift; -- cgit v1.2.3