On Thu, 15 Nov 2007 14:37:22 +0100, Nis Martensen wrote:
>  * Include feedlink template only if at least one of $rss or $atom is
>    defined.

This part was unnecessary: One should use »feeds=no« instead. Remaining
part of the previous patch below. Tested against latest git.


>From 78372f9d5d21e1889d96f6740bedc4ad21dd8ce5 Mon Sep 17 00:00:00 2001
From: Nis Martensen <[EMAIL PROTECTED]>
Date: Tue, 20 Nov 2007 12:48:47 +0100
Subject: [PATCH] Add an option to move feedlinks to below the inlined content

In case no postform is provided, "feedlinksbelow=yes" can be used to
move the feedlinks down.
---
 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..34fea53 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 && ! $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 && $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.5.726.g41a7a



Reply via email to