+ my $onlystrip=shift || 0; # strip directives without processing
+
+ my $handle=sub {
+ my $escape=shift;
+ my $command=shift;
+ my $params=shift;
+ if (length $escape) {
+ return "[[$command $params]]";
+ }
+ elsif ($onlystrip) {
+ return "";
+ }
+ elsif (exists $hooks{preprocess}{$command}) {
+ # Note: preserve order of params, some plugins may
+ # consider it significant.
+ my @params;
+ while ($params =~ /(\w+)=\"?([^"]+)"?(\s+|$)/g) {
+ push @params, $1, $2;
+ }
+ return $hooks{preprocess}{$command}{call}->(@params, page => $page);
+ }
+ else {
+ return "[[$command not processed]]";
+ }
+ };
+
+ $content =~ s{(\\?)$config{wiki_processor_regexp}}{$handle->($1, $2, $3)}eg;
+ return $content;
+} #}}}
+
+sub add_depends ($$) { #{{{