summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-23 15:11:25 -0400
committerJoey Hess <joey@kitenet.net>2010-04-23 15:11:25 -0400
commitd1cc7e81c84e57c32b6560f82065caf6535c0692 (patch)
tree25aeef8df354488c792b7290c2403d5412043a02 /IkiWiki/Plugin
parent78fd3b35a2805489185a14e00b53b450eec961f1 (diff)
use template() rather than rolling it by hand
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/edittemplate.pm22
1 files changed, 6 insertions, 16 deletions
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);