- my $skip=1;
- return if $page eq 'index'; # toplevel
- foreach my $dir (reverse split("/", $page)) {
- if (! $skip) {
- $path.="../";
- unshift @ret, { url => "$path$dir.html", page => pagetitle($dir) };
- }
- else {
- $skip=0;
- }
- }
- unshift @ret, { url => length $path ? $path : ".", page => $config{wikiname} };
- return @ret;
-} #}}}
-
-sub preprocess ($$$;$) { #{{{
- my $page=shift; # the page the data comes from
- my $destpage=shift; # the page the data will appear in (different for inline)
- my $content=shift;
- 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+))(?:\s+|$)/g) {
- if (defined $1) {
- push @params, $1, (defined $2 ? $2 : $3);
- }
- else {
- push @params, (defined $2 ? $2 : $3), '';
- }
- }
- return $hooks{preprocess}{$command}{call}->(
- @params,
- page => $page,
- destpage => $destpage,
- );
- }
- else {
- return "[[$command not processed]]";
- }
- };
-
- $content =~ s{(\\?)$config{wiki_processor_regexp}}{$handle->($1, $2, $3)}eg;
- return $content;
-} #}}}
-
-sub add_depends ($$) { #{{{
- my $page=shift;
- my $globlist=shift;