Package: ikiwiki
Version: 2.9
Severity: wishlist
Tags: patch

Carl had just swapped the code snippets in inline.pm to get the
behaviour which can be seen in <http://cairographics.org/news/>.
Since this seems not appropriate for upstream, maybe something like
this? Unlike the last three patches, this one is actually from me.
Only tested with ikiwiki 2.9.
>From c1fcaf33156dfa595c2b0e606323edcc7b4d314d Mon Sep 17 00:00:00 2001
From: Nis Martensen <[EMAIL PROTECTED]>
Date: Thu, 15 Nov 2007 13:51:40 +0100
Subject: [PATCH] Allow moving the feedlinks to below the inlined content

 * This adds a parameter "feedlinksbelow" to the inline plugin. Set this
   to "yes" to move the feedlinks below the inlined content. This
   change is done only when no postform is included, in which case the
   feedlinks will still be above.

 * Include feedlink template only if at least one of $rss or $atom is
   defined.
---
 IkiWiki/Plugin/inline.pm |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index ebeb231..dc9b5e3 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -114,6 +114,10 @@ sub preprocess_inline (@) { #{{{
                $params{template} = $archive ? "archivepage" : "inlinepage";
        }
 
+       my $form = ($config{cgiurl} && (exists $params{rootpage} ||
+                       (exists $params{postform} && 
yesno($params{postform})))) ? 1 : 0;
+       my $feedlinksbelow = exists $params{feedlinksbelow} ? 
yesno($params{feedlinksbelow}) : 0;
+
        my @list;
        foreach my $page (keys %pagesources) {
                next if $page eq $params{page};
@@ -173,8 +177,7 @@ sub preprocess_inline (@) { #{{{
        my $atomurl=basename(atompage($params{destpage}).$feednum);
        my $ret="";
 
-       if ($config{cgiurl} && (exists $params{rootpage} ||
-                       (exists $params{postform} && 
yesno($params{postform})))) {
+       if ($form) {
                # Add a blog post form, with feed buttons.
                my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
                $formtemplate->param(cgiurl => $config{cgiurl});
@@ -192,7 +195,7 @@ sub preprocess_inline (@) { #{{{
                }
                $ret.=$formtemplate->output;
        }
-       elsif ($feeds) {
+       elsif ($feeds && ($rss || $atom) && ! $feedlinksbelow) {
                # Add feed buttons.
                my $linktemplate=template("feedlink.tmpl", blind_cache => 1);
                $linktemplate->param(rssurl => $rssurl) if $rss;
@@ -266,6 +269,14 @@ sub preprocess_inline (@) { #{{{
                }
        }
        
+       if (! $form && $feeds && ($rss || $atom) && $feedlinksbelow) {
+               # Add feed buttons.
+               my $linktemplate=template("feedlink.tmpl", blind_cache => 1);
+               $linktemplate->param(rssurl => $rssurl) if $rss;
+               $linktemplate->param(atomurl => $atomurl) if $atom;
+               $ret.=$linktemplate->output;
+       }
+
        if ($feeds) {
                if (exists $params{feedshow} && @list > $params{feedshow}) {
                        @[EMAIL PROTECTED] - 1];
-- 
1.5.3.4.206.g58ba4

Reply via email to