- elsif ($preprocessing{$page}++ > 10) {
- # Avoid loops of preprocessed pages preprocessing
- # other pages that preprocess them, etc.
- return "[[$command preprocessing loop detected]]";
- }
- elsif (exists $hooks{preprocess}{$command}) {
- # Note: preserve order of params, some plugins may
- # consider it significant.
- my @params;
- while ($params =~ /(?:(\w+)=)?(?:"""(.*?)"""|"([^"]+)"|(\S+))(?:\s+|$)/sg) {
- my $key=$1;
- my $val;
- if (defined $2) {
- $val=$2;
- $val=~s/\r\n/\n/mg;
- $val=~s/^\n+//g;
- $val=~s/\n+$//g;
- }
- elsif (defined $3) {
- $val=$3;
- }
- elsif (defined $4) {
- $val=$4;
- }
-
- if (defined $key) {
- push @params, $key, $val;
- }
- else {
- push @params, $val, '';
- }
- }
- my $ret=$hooks{preprocess}{$command}{call}->(
- @params,
- page => $page,
- destpage => $destpage,
- );
- $preprocessing{$page}--;
- return $ret;
- }
- else {
- return "[[$command not processed]]";
- }
- };
-
- $content =~ s{(\\?)\[\[(\w+)\s+((?:(?:\w+=)?(?:""".*?"""|"[^"]+"|[^\s\]]+)\s*)*)\]\]}{$handle->($1, $2, $3)}seg;
- return $content;
-} #}}}
-
-sub add_depends ($$) { #{{{
- my $page=shift;
- my $pagespec=shift;
-
- if (! exists $depends{$page}) {
- $depends{$page}=$pagespec;
- }
- else {
- $depends{$page}=pagespec_merge($depends{$page}, $pagespec);
- }
-} # }}}
-
-sub genpage ($$$) { #{{{
- my $page=shift;
- my $content=shift;
- my $mtime=shift;
-
- my $template=template("page.tmpl", blind_cache => 1);