]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/inline.pm
* Add feedshow option to allow reducing the number of items included in
[ikiwiki.git] / IkiWiki / Plugin / inline.pm
index 13ff0aa19c92ea5b97134240b97c985b732b30fa..06b74b3fab0442654e6ecd25772cf19efd0bab5f 100644 (file)
@@ -156,11 +156,14 @@ sub preprocess_inline (@) { #{{{
                        if ($actions) {
                                my $file = $pagesources{$page};
                                my $type = pagetype($file);
-                               if ($config{discussion} &&
-                                   $page !~ /.*\/discussion$/ &&
-                                   (length $config{cgiurl} || exists $links{$page."/".gettext("discussion")})) {
-                                       $template->param(have_actions => 1);
-                                       $template->param(discussionlink => htmllink($page, $params{page}, "Discussion", 1, 1));
+                               if ($config{discussion}) {
+                                       my $discussionlink=gettext("discussion");
+                                       if ($page !~ /.*\/\Q$discussionlink\E$/ &&
+                                           (length $config{cgiurl} ||
+                                            exists $links{$page."/".$discussionlink})) {
+                                               $template->param(have_actions => 1);
+                                               $template->param(discussionlink => htmllink($page, $params{page}, gettext("Discussion"), 1, 1));
+                                       }
                                }
                                if (length $config{cgiurl} && defined $type) {
                                        $template->param(have_actions => 1);
@@ -187,19 +190,25 @@ sub preprocess_inline (@) { #{{{
                }
        }
        
-       if ($feeds && $rss) {
-               will_render($params{page}, rsspage($params{page}));
-               writefile(rsspage($params{page}), $config{destdir},
-                       genfeed("rss", $rssurl, $desc, $params{page}, @list));
-               $toping{$params{page}}=1 unless $config{rebuild};
-               $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
-       }
-       if ($feeds && $atom) {
-               will_render($params{page}, atompage($params{page}));
-               writefile(atompage($params{page}), $config{destdir},
-                       genfeed("atom", $atomurl, $desc, $params{page}, @list));
-               $toping{$params{page}}=1 unless $config{rebuild};
-               $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
+       if ($feeds) {
+               if (exists $params{feedshow} && @list > $params{feedshow}) {
+                       @list=@list[0..$params{feedshow} - 1];
+               }
+       
+               if ($rss) {
+                       will_render($params{page}, rsspage($params{page}));
+                       writefile(rsspage($params{page}), $config{destdir},
+                               genfeed("rss", $rssurl, $desc, $params{page}, @list));
+                       $toping{$params{page}}=1 unless $config{rebuild};
+                       $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/rss+xml" title="RSS" href="$rssurl" />};
+               }
+               if ($atom) {
+                       will_render($params{page}, atompage($params{page}));
+                       writefile(atompage($params{page}), $config{destdir},
+                               genfeed("atom", $atomurl, $desc, $params{page}, @list));
+                       $toping{$params{page}}=1 unless $config{rebuild};
+                       $feedlinks{$params{destpage}}=qq{<link rel="alternate" type="application/atom+xml" title="Atom" href="$atomurl" />};
+               }
        }
        
        return $ret;