+ 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}, $params{timeformat}));
+ $template->param(mtime => displaytime($pagemtime{$page}, $params{timeformat}));
+ $template->param(first => 1) if $page eq $list[0];
+ $template->param(last => 1) if $page eq $list[$#list];
+
+ 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 => $page));
+ }
+ }
+
+ 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)))));
+ }