summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-09-13 22:23:32 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-09-13 22:23:32 +0000
commit95199c5b04faaf0a619b64a492f46a785e4e4d60 (patch)
treec40ba50580241a416fb7754b0086bba7d508a4b0 /IkiWiki
parent23d38e0276dd6526b2d26f789fda9bb534e8f30f (diff)
* inline: add feedonly option, set feedonly=yes to get only the feed button
but not inline the pages.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/inline.pm113
1 files changed, 58 insertions, 55 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)))));
+ }
}
}
}