X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/54d5308cd83c67e7e9c32450c776ef0dac63549f..a44bfb158dac9e04647a75bc819a73bc18f5acce:/IkiWiki/Render.pm diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index f9730193b..f90f16335 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -5,6 +5,7 @@ package IkiWiki; use warnings; use strict; use File::Spec; +use IkiWiki; sub linkify ($$) { #{{{ my $content=shift; @@ -133,15 +134,15 @@ sub preprocess ($$) { #{{{ if (length $escape) { return "[[$command $params]]"; } - elsif (exists $plugins{preprocess}{$command}) { + elsif (exists $hooks{preprocess}{$command}) { my %params; while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) { $params{$1}=$2; } - return $plugins{preprocess}{$command}->(page => $page, %params); + return $hooks{preprocess}{$command}{call}->(page => $page, %params); } else { - return "[[bad directive $command]]"; + return "[[$command not processed]]"; } }; @@ -157,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;