From 95199c5b04faaf0a619b64a492f46a785e4e4d60 Mon Sep 17 00:00:00 2001 From: joey Date: Thu, 13 Sep 2007 22:23:32 +0000 Subject: * inline: add feedonly option, set feedonly=yes to get only the feed button but not inline the pages. --- IkiWiki/Plugin/inline.pm | 113 ++++++++++++++++++++++++----------------------- debian/changelog | 4 +- doc/blog.mdwn | 2 + po/ikiwiki.pot | 14 +++--- 4 files changed, 70 insertions(+), 63 deletions(-) diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 30b09d1ad..0b3d5e406 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -93,6 +93,7 @@ sub preprocess_inline (@) { #{{{ my $quick=exists $params{quick} ? yesno($params{quick}) : 0; my $feeds=exists $params{feeds} ? yesno($params{feeds}) : !$quick; $feeds=0 if $params{preview}; + my $feedonly=yesno($params{feedonly}); if (! exists $params{show} && ! $archive) { $params{show}=10; } @@ -180,66 +181,68 @@ sub preprocess_inline (@) { #{{{ $ret.=$linktemplate->output; } - require HTML::Template; - my @params=IkiWiki::template_params($params{template}.".tmpl", blind_cache => 1); - if (! @params) { - return sprintf(gettext("nonexistant template %s"), $params{template}); - } - my $template=HTML::Template->new(@params) unless $raw; + if (! $feedonly) { + require HTML::Template; + my @params=IkiWiki::template_params($params{template}.".tmpl", blind_cache => 1); + if (! @params) { + return sprintf(gettext("nonexistant template %s"), $params{template}); + } + my $template=HTML::Template->new(@params) unless $raw; - foreach my $page (@list) { - my $file = $pagesources{$page}; - my $type = pagetype($file); - if (! $raw || ($raw && ! defined $type)) { - unless ($archive && $quick) { - # Get the content before populating the - # template, since getting the content uses - # the same template if inlines are nested. - my $content=get_inline_content($page, $params{destpage}); - $template->param(content => $content); - } - $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); - $template->param(title => pagetitle(basename($page))); - $template->param(ctime => displaytime($pagectime{$page})); - - if ($actions) { - my $file = $pagesources{$page}; - my $type = pagetype($file); - if ($config{discussion}) { - my $discussionlink=gettext("discussion"); - if ($page !~ /.*\/\Q$discussionlink\E$/ && - (length $config{cgiurl} || - exists $links{$page."/".$discussionlink})) { + foreach my $page (@list) { + my $file = $pagesources{$page}; + my $type = pagetype($file); + if (! $raw || ($raw && ! defined $type)) { + unless ($archive && $quick) { + # Get the content before populating the + # template, since getting the content uses + # the same template if inlines are nested. + my $content=get_inline_content($page, $params{destpage}); + $template->param(content => $content); + } + $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); + $template->param(title => pagetitle(basename($page))); + $template->param(ctime => displaytime($pagectime{$page})); + + if ($actions) { + my $file = $pagesources{$page}; + my $type = pagetype($file); + 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"), + noimageinline => 1, + forcesubpage => 1)); + } + } + if (length $config{cgiurl} && defined $type) { $template->param(have_actions => 1); - $template->param(discussionlink => - htmllink($page, - $params{page}, - gettext("Discussion"), - noimageinline => 1, - forcesubpage => 1)); + $template->param(editurl => cgiurl(do => "edit", page => pagetitle($page, 1))); } } - if (length $config{cgiurl} && defined $type) { - $template->param(have_actions => 1); - $template->param(editurl => cgiurl(do => "edit", page => pagetitle($page, 1))); - } + + run_hooks(pagetemplate => sub { + shift->(page => $page, destpage => $params{page}, + template => $template,); + }); + + $ret.=$template->output; + $template->clear_params; } - - run_hooks(pagetemplate => sub { - shift->(page => $page, destpage => $params{page}, - template => $template,); - }); - - $ret.=$template->output; - $template->clear_params; - } - else { - if (defined $type) { - $ret.="\n". - linkify($page, $params{page}, - preprocess($page, $params{page}, - filter($page, $params{page}, - readfile(srcfile($file))))); + else { + if (defined $type) { + $ret.="\n". + linkify($page, $params{page}, + preprocess($page, $params{page}, + filter($page, $params{page}, + readfile(srcfile($file))))); + } } } } diff --git a/debian/changelog b/debian/changelog index 3d4005416..749055e73 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,10 @@ ikiwiki (2.8) UNRELEASED; urgency=low * Redid the debian/copyright file, using the proposed new copyright file format. Included many details not previously listed in the old file. + * inline: add feedonly option, set feedonly=yes to get only the feed button + but not inline the pages. - -- Joey Hess Mon, 10 Sep 2007 20:25:40 -0400 + -- Joey Hess Thu, 13 Sep 2007 18:07:51 -0400 ikiwiki (2.7) unstable; urgency=low diff --git a/doc/blog.mdwn b/doc/blog.mdwn index 1593278d1..2792a35b1 100644 --- a/doc/blog.mdwn +++ b/doc/blog.mdwn @@ -91,3 +91,5 @@ directive: specifying a tighter [[PageSpec]] here. * `feedshow` - Specify the maximum number of matching pages to include in the rss/atom feeds. The default is the same as the `show` value above, +* `feedonly` - Only generate the feed, do not display the pages inline on + the page. diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index ebc61d48c..381009ae2 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-09-07 13:04-0400\n" +"POT-Creation-Date: 2007-09-13 18:22-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,7 +42,7 @@ msgid "%s is not an editable page" msgstr "" #: ../IkiWiki/CGI.pm:441 ../IkiWiki/Plugin/brokenlinks.pm:24 -#: ../IkiWiki/Plugin/inline.pm:209 ../IkiWiki/Plugin/opendiscussion.pm:17 +#: ../IkiWiki/Plugin/inline.pm:211 ../IkiWiki/Plugin/opendiscussion.pm:17 #: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99 #: ../IkiWiki/Render.pm:179 msgid "discussion" @@ -177,25 +177,25 @@ msgstr "" msgid "Must specify url to wiki with --url when using --rss or --atom" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:131 +#: ../IkiWiki/Plugin/inline.pm:132 #, perl-format msgid "unknown sort type %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:171 +#: ../IkiWiki/Plugin/inline.pm:172 msgid "Add a new post titled:" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:186 +#: ../IkiWiki/Plugin/inline.pm:188 #, perl-format msgid "nonexistant template %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:217 ../IkiWiki/Render.pm:103 +#: ../IkiWiki/Plugin/inline.pm:219 ../IkiWiki/Render.pm:103 msgid "Discussion" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:430 +#: ../IkiWiki/Plugin/inline.pm:433 msgid "RPC::XML::Client not found, not pinging" msgstr "" -- cgit v1.2.3