X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/e4ccc4f3b09aaaa4f64bdba1d6ffff24e924fd20..e8ec0187dad6eb81e71fedfaefced2dc2f6b2fda:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 110410abc..56adaf509 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -5,6 +5,7 @@ package IkiWiki::Plugin::inline; use warnings; use strict; use IkiWiki; +use URI; sub import { #{{{ IkiWiki::hook(type => "preprocess", id => "inline", @@ -35,6 +36,9 @@ sub preprocess_inline (@) { #{{{ if (! exists $params{show} && $params{archive} eq "no") { $params{show}=10; } + if (! exists $params{rss}) { + $params{rss}="yes"; + } # Avoid nested inlines, to avoid loops etc. if ($processing_inline) { @@ -45,7 +49,7 @@ sub preprocess_inline (@) { #{{{ my @list; foreach my $page (keys %pagesources) { next if $page eq $params{page}; - if (globlist_match($page, $params{pages})) { + if (pagespec_match($page, $params{pages})) { push @list, $page; } } @@ -68,7 +72,7 @@ sub preprocess_inline (@) { #{{{ } $ret.=$formtemplate->output; } - elsif ($config{rss}) { + elsif ($config{rss} && $params{rss} eq "yes") { # Add a rss link button. my $linktemplate=template("rsslink.tmpl", blind_cache => 1); $linktemplate->param(rssurl => rsspage(basename($params{page}))); @@ -105,7 +109,7 @@ sub preprocess_inline (@) { #{{{ # TODO: should really add this to renderedfiles and call # check_overwrite, but currently renderedfiles # only supports listing one file per page. - if ($config{rss}) { + if ($config{rss} && $params{rss} eq "yes") { writefile(rsspage($params{page}), $config{destdir}, genrss($params{page}, @list)); $toping{$params{page}}=1 unless $config{rebuild}; @@ -134,7 +138,11 @@ sub date_822 ($) { #{{{ my $time=shift; eval q{use POSIX}; - return POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time)); + my $lc_time= POSIX::setlocale(&POSIX::LC_TIME); + POSIX::setlocale(&POSIX::LC_TIME, "C"); + my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time)); + POSIX::setlocale(&POSIX::LC_TIME, $lc_time); + return $ret; } #}}} sub absolute_urls ($$) { #{{{ @@ -159,7 +167,7 @@ sub genrss ($@) { #{{{ my $page=shift; my @pages=@_; - my $url="$config{url}/".htmlpage($page); + my $url=URI->new(encode_utf8("$config{url}/".htmlpage($page))); my $itemtemplate=template("rssitem.tmpl", blind_cache => 1, die_on_bad_params => 0); @@ -167,9 +175,12 @@ sub genrss ($@) { #{{{ foreach my $p (@pages) { next unless exists $renderedfiles{$p}; + my $u=URI->new(encode_utf8("$config{url}/$renderedfiles{$p}")); + $itemtemplate->param( title => pagetitle(basename($p)), - url => "$config{url}/$renderedfiles{$p}", + url => $u, + permalink => $u, pubdate => date_822($pagectime{$p}), content => absolute_urls(get_inline_content($p, $page), $url), ); @@ -177,6 +188,7 @@ sub genrss ($@) { #{{{ shift->(page => $p, destpage => $page, template => $itemtemplate); }); + $content.=$itemtemplate->output; $itemtemplate->clear_params; } @@ -188,7 +200,6 @@ sub genrss ($@) { #{{{ pageurl => $url, content => $content, ); - run_hooks(pagetemplate => sub { shift->(page => $page, destpage => $page, template => $template);