X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/20ba12802b3897bf48d8a7704a57e9cede2466bd..b8dcaf91d02c1d8754032c60f8d713261dafffe4:/IkiWiki/Plugin/edittemplate.pm diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 5f0551d92..d65072010 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -114,28 +114,18 @@ sub filltemplate ($$) { my $template_page=shift; my $page=shift; - my $template_file=$pagesources{$template_page}; - if (! defined $template_file) { - return; - } - my $template; eval { - $template=HTML::Template->new( - filter => sub { - my $text_ref = shift; - $$text_ref=&Encode::decode_utf8($$text_ref); - chomp $$text_ref; - }, - filename => srcfile($template_file), - die_on_bad_params => 0, - no_includes => 1, - ); + # force page name absolute so it doesn't look in templates/ + $template=template("/".$template_page); }; if ($@) { # Indicate that the earlier preprocessor directive set # up a template that doesn't work. - return "[[!pagetemplate ".gettext("failed to process")." $@]]"; + return "[[!pagetemplate ".gettext("failed to process template:")." $@]]"; + } + if (! defined $template) { + return; } $template->param(name => $page);