-sub date_822 ($) { #{{{
- my $time=shift;
-
- eval q{use POSIX};
- return POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time));
-} #}}}
-
-sub absolute_urls ($$) { #{{{
- # sucky sub because rss sucks
- my $content=shift;
- my $url=shift;
-
- $url=~s/[^\/]+$//;
-
- $content=~s/<a\s+href="(?!http:\/\/)([^"]+)"/<a href="$url$1"/ig;
- $content=~s/<img\s+src="(?!http:\/\/)([^"]+)"/<img src="$url$1"/ig;
- return $content;
-} #}}}
-
-sub genrss ($$$) { #{{{
- my $content=shift;
- my $page=shift;
- my $mtime=shift;
-
- my $url="$config{url}/".htmlpage($page);
-
- my $template=HTML::Template->new(blind_cache => 1,
- filename => "$config{templatedir}/rsspage.tmpl");
-
- my @items;
- my $isblog=0;
- my $gen_blog=sub {
- my $parentpage=shift;
- my %params=@_;
-
- if (! exists $params{show}) {
- $params{show}=10;
- }
- if (! exists $params{pages}) {
- return "";
- }
-
- $isblog=1;
- foreach my $page (blog_list($params{pages}, $params{show})) {
- next if $page eq $parentpage;
- push @items, {
- itemtitle => pagetitle(basename($page)),
- itemurl => "$config{url}/$renderedfiles{$page}",
- itempubdate => date_822($pagectime{$page}),
- itemcontent => absolute_urls(get_inline_content($parentpage, $page), $url),
- } if exists $renderedfiles{$page};
- }
-
- return "";
- };
-
- $content = postprocess($page, $content, inline => $gen_blog);
-
- $template->param(
- title => $config{wikiname},
- pageurl => $url,
- items => \@items,
- );
-
- return $template->output;
-} #}}}
-