- foreach my $page (@list) {
- # Don't use htmllink because this way the title is separate
- # and can be overridden by other plugins.
- my $link=htmlpage(bestlink($params{page}, $page));
- $link=abs2rel($link, dirname($params{page}));
- $template->param(pageurl => $link);
- $template->param(title => pagetitle(basename($page)));
- $template->param(content => get_inline_content($page, $params{page}))
- if $params{archive} eq "no";
- $template->param(ctime => displaytime($pagectime{$page}));
-
- run_hooks(pagetemplate => sub {
- shift->(page => $page, destpage => $params{page},
- template => $template,);
- });
-
- $ret.=$template->output;
- $template->clear_params;
+ 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}, $params{timeformat}));
+
+ 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{destpage},
+ gettext("Discussion"),
+ noimageinline => 1,
+ forcesubpage => 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{destpage},
+ template => $template,);
+ });
+
+ $ret.=$template->output;
+ $template->clear_params;
+ }
+ else {
+ if (defined $type) {
+ $ret.="\n".
+ linkify($page, $params{destpage},
+ preprocess($page, $params{destpage},
+ filter($page, $params{destpage},
+ readfile(srcfile($file)))));
+ }
+ }
+ }