]> sipb.mit.edu Git - ikiwiki.git/commitdiff
inline: Support emptyfeeds=no option to skip generating empty feeds.
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 11 Dec 2008 19:04:38 +0000 (14:04 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 11 Dec 2008 19:04:38 +0000 (14:04 -0500)
IkiWiki/Plugin/inline.pm
debian/changelog
doc/ikiwiki/directive/inline.mdwn
doc/todo/inline_plugin:_hide_feed_buttons_if_empty.mdwn

index 0c8f503847aeb54cc0f08b68316673561c7ae936..5e4df95f4dc851653d28f64124678953c4905340 100644 (file)
@@ -161,6 +161,7 @@ sub preprocess_inline (@) { #{{{
        my $atom=(($config{atom} || $config{allowatom}) && exists $params{atom}) ? yesno($params{atom}) : $config{atom};
        my $quick=exists $params{quick} ? yesno($params{quick}) : 0;
        my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick;
+       my $emptyfeeds=exists $params{emptyfeeds} ? yesno($params{emptyfeeds}) : 1;
        my $feedonly=yesno($params{feedonly});
        if (! exists $params{show} && ! $archive) {
                $params{show}=10;
@@ -289,8 +290,13 @@ sub preprocess_inline (@) { #{{{
                                gettext("Add a new post titled:"));
                }
                $ret.=$formtemplate->output;
+               
+               # The post form includes the feed buttons, so
+               # emptyfeeds cannot be hidden.
+               $emptyfeeds=1;
        }
-       elsif ($feeds && !$params{preview}) {
+       elsif ($feeds && !$params{preview} &&
+              ! (! $emptyfeeds && ! @feedlist)) {
                # Add feed buttons.
                my $linktemplate=template("feedlink.tmpl", blind_cache => 1);
                $linktemplate->param(rssurl => $rssurl) if $rss;
@@ -367,7 +373,7 @@ sub preprocess_inline (@) { #{{{
                }
        }
        
-       if ($feeds) {
+       if ($feeds && ! (! $emptyfeeds && ! @feedlist)) {
                if ($rss) {
                        my $rssp=rsspage($params{destpage}).$feednum;
                        will_render($params{destpage}, $rssp);
index 8d2b6661f1a92ffada9464418288b85dbd412b24..7f68443667c69c0bd082579f636fd18e8ec7e5df 100644 (file)
@@ -10,6 +10,7 @@ ikiwiki (2.71) UNRELEASED; urgency=low
   * Fix handling of wrappergroup option.
   * Correct --dumpsetup to include the srcdir in the setup file.
   * German translation update from Kai Wasserbäch. Closes: #507056
+  * inline: Support emptyfeeds=no option to skip generating empty feeds.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 17 Nov 2008 14:02:10 -0500
 
index 9889cda114bfb9b12effcbf82bef91e615811981..82b532e0c371a1dd0dd5050dac1b72cd73ae17f0 100644 (file)
@@ -73,6 +73,8 @@ Here are some less often needed parameters:
   configured to `allowatom`, set to "yes" to enable.
 * `feeds` - controls generation of all types of feeds. Set to "no" to
   disable generating any feeds.
+* `emptyfeeds` - Set to "no" to disable generation of empty feeds.
+  Has no effect if `rootpage` or `postform` is set.
 * `template` - Specifies the template to fill out to display each inlined
   page. By default the `inlinepage` template is used, while
   the `archivepage` template is used for archives. Set this parameter to
@@ -97,7 +99,7 @@ Here are some less often needed parameters:
   in the blog. The format string is passed to the strftime(3) function.
 * `feedpages` - A [[PageSpec]] of inlined pages to include in the rss/atom
   feeds. The default is the same as the `pages` value above, and only pages
-  matches by that value are included, but some of those can be excluded by
+  matched by that value are included, but some of those can be excluded by
   specifying a tighter [[PageSpec]] here.
 * `guid` - If a URI is given here (perhaps a UUID prefixed with `urn:uuid:`),
   the Atom feed will have this as its `<id>`. The default is to use the URL
index f998d5654f69017e70607bc93ced068a6126c21e..d046c0cd01d1b40cb987ae4097de8d1fc716e38a 100644 (file)
@@ -2,3 +2,6 @@
                drop the rss/atom buttons for comments when there are none yet
 
 This seems to me like something that applies to the [[plugins/inline]] plugin in general, rather than the [[plugins/contrib/comments]] plugin specifically. --[[smcv]]
+
+>> [[done]] as emptyfeeds option, not on by default for inline, but I think
+>> it should be for comments --[[Joey]]