X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/7bba52254569047ef1d9f5752096f155b0a2be77..09916a90ed9f22212ac62078132fd2375ed0017f:/IkiWiki/Plugin/template.pm diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index d2b2fef55..ccc9cb666 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -41,34 +41,33 @@ sub preprocess (@) { blind_cache => 1); }; if ($@) { - error gettext("failed to process template:")." $@"; - } - if (! $template) { - error sprintf(gettext("%s not found"), + # gettext can clobber $@ + my $error = $@; + error sprintf(gettext("failed to process template %s"), htmllink($params{page}, $params{destpage}, - "/templates/$params{id}")) + "/templates/$params{id}"))." $error"; } $params{basename}=IkiWiki::basename($params{page}); foreach my $param (keys %params) { my $value=IkiWiki::preprocess($params{page}, $params{destpage}, - IkiWiki::filter($params{page}, $params{destpagea}, - $params{$param}), $scan); + $params{$param}, $scan); if ($template->query(name => $param)) { - $template->param($param => - IkiWiki::htmlize($params{page}, $params{destpage}, + my $htmlvalue=IkiWiki::htmlize($params{page}, $params{destpage}, pagetype($pagesources{$params{page}}), - $value)); + $value); + chomp $htmlvalue; + $template->param($param => $htmlvalue); } if ($template->query(name => "raw_$param")) { + chomp $value; $template->param("raw_$param" => $value); } } return IkiWiki::preprocess($params{page}, $params{destpage}, - IkiWiki::filter($params{page}, $params{destpage}, - $template->output), $scan); + $template->output, $scan); } 1