-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 @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{show}) {
- $params{show}=10;
- }
- if (! exists $params{pages}) {
- return "";
- }
- $inlinepages{$parentpage}=$params{pages};
-
- my $template=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/inlinepage.tmpl");
-
- my $ret="";
- foreach my $page (blog_list($params{pages}, $params{show})) {
- $template->param(pagelink => htmllink($parentpage, $page));
- $template->param(content => get_inline_content($parentpage, $page));
- $template->param(ctime => scalar(gmtime($pagectime{$page})));
- $ret.=$template->output;
- }
-
- return $ret;
-} #}}}
-