From a9695cf73b1fd46dd908aeac400eebb7f583b5c4 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 12 Nov 2010 14:41:03 +0100 Subject: [PATCH] inline plugin: allow users to change feed links location Rather than hardcoding the feed link location right before the actual page inlining, we pass the feed links as parameters to the template so that the user can choose where to place them. The default inlinepage template is modified to account for the change. --- IkiWiki/Plugin/inline.pm | 10 +++++++++- templates/inlinepage.tmpl | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 765271564..73a35948c 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -294,6 +294,7 @@ sub preprocess_inline (@) { my $atomurl=abs2rel($feedbase."atom".$feednum, dirname(htmlpage($params{destpage}))) if $feeds && $atom; my $ret=""; + my $feedlinksincluded=0; if (length $config{cgiurl} && ! $params{preview} && (exists $params{rootpage} || (exists $params{postform} && yesno($params{postform}))) && @@ -317,13 +318,15 @@ sub preprocess_inline (@) { # The post form includes the feed buttons, so # emptyfeeds cannot be hidden. $emptyfeeds=1; + $feedlinksincluded=1; } - elsif ($feeds && !$params{preview} && ($emptyfeeds || @feedlist)) { + elsif ($feeds && !$params{preview} && ($emptyfeeds || @feedlist) && $feedonly) { # Add feed buttons. my $linktemplate=template_depends("feedlink.tmpl", $params{page}, blind_cache => 1); $linktemplate->param(rssurl => $rssurl) if $rss; $linktemplate->param(atomurl => $atomurl) if $atom; $ret.=$linktemplate->output; + $feedlinksincluded=1; } if (! $feedonly) { @@ -360,6 +363,11 @@ sub preprocess_inline (@) { $template->param(first => 1) if $page eq $list[0]; $template->param(last => 1) if $page eq $list[$#list]; $template->param(html5 => $config{html5}); + if (! $feedlinksincluded) { + $template->param(hasfeeds => 1); + $template->param(rssurl => $rssurl) if $rss; + $template->param(atomurl => $atomurl) if $atom; + } if ($actions) { my $file = $pagesources{$page}; diff --git a/templates/inlinepage.tmpl b/templates/inlinepage.tmpl index b0b53d041..f543c274c 100644 --- a/templates/inlinepage.tmpl +++ b/templates/inlinepage.tmpl @@ -1,3 +1,13 @@ + + +
-- 2.32.0.93.g670b81a890