- my $skip=1;
- foreach my $dir (reverse split("/", $page)) {
- if (! $skip) {
- $path.="../";
- unshift @ret, { url => "$path$dir.html", page => $dir };
- }
- else {
- $skip=0;
- }
- }
- unshift @ret, { url => length $path ? $path : ".", page => $config{wikiname} };
- return @ret;
-} #}}}
-
-sub rsspage ($) { #{{{
- my $page=shift;
-
- return $page.".rss";
-} #}}}
-
-sub postprocess { #{{{
- # Takes content to postprocess followed by a list of postprocessor
- # commands and subroutine references to run for the commands.
- my $page=shift;
- my $content=shift;
- my %commands=@_;
-
- my $handle=sub {
- my $escape=shift;
- my $command=shift;
- my $params=shift;
- if (length $escape) {
- "[[$command $params]]";
- }
- elsif (exists $commands{$command}) {
- my %params;
- while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
- $params{$1}=$2;
- }
- $commands{$command}->($page, %params);
- }
- else {
- "[[bad directive $command]]";
- }
- };
-
- $content =~ s{(\\?)$config{wiki_processor_regexp}}{$handle->($1, $2, $3)}eg;
- return $content;
-} #}}}
-
-sub blog_list ($$) { #{{{
- my $globlist=shift;
- my $maxitems=shift;
-
- my @list;
- foreach my $page (keys %pagesources) {
- if (globlist_match($page, $globlist)) {
- push @list, $page;
- }
- }
-
- @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list;
- return @list if ! $maxitems || @list <= $maxitems;
- return @list[0..$maxitems - 1];
-} #}}}
-
-sub get_inline_content ($$) { #{{{
- my $parentpage=shift;
- my $page=shift;
-
- my $file=$pagesources{$page};
- my $type=pagetype($file);
- if ($type ne 'unknown') {
- return htmlize($type, linkify(readfile("$config{srcdir}/$file"), $parentpage));
- }
- else {
- return "";
- }
-} #}}}
-
-sub postprocess_html_inline { #{{{
- my $parentpage=shift;
- my %params=@_;
-
- if (! exists $params{pages}) {
- return "";
- }
- if (! exists $params{archive}) {
- $params{archive}="no";
- }
- if (! exists $params{show} && $params{archive} eq "no") {
- $params{show}=10;
- }
- $inlinepages{$parentpage}=$params{pages};
-
- my $template=HTML::Template->new(blind_cache => 1,
- filename => (($params{archive} eq "no")
- ? "$config{templatedir}/inlinepage.tmpl"
- : "$config{templatedir}/inlinepagetitle.tmpl"));