summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm8
-rw-r--r--IkiWiki/Plugin/edittemplate.pm3
-rw-r--r--IkiWiki/Plugin/inline.pm5
-rw-r--r--IkiWiki/Plugin/template.pm7
-rw-r--r--doc/plugins/write.mdwn2
5 files changed, 10 insertions, 15 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 6da281999..66ae86809 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1769,12 +1769,14 @@ sub template_depends ($$;@) {
my $page=shift;
my ($filename, $tpage, $untrusted)=template_file($name);
+ if (! defined $filename) {
+ error(sprintf(gettext("template %s not found"), $name))
+ }
+
if (defined $page && defined $tpage) {
add_depends($page, $tpage);
}
-
- return unless defined $filename;
-
+
my @opts=(
filter => sub {
my $text_ref = shift;
diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm
index 4f07866e4..576c94be4 100644
--- a/IkiWiki/Plugin/edittemplate.pm
+++ b/IkiWiki/Plugin/edittemplate.pm
@@ -132,9 +132,6 @@ sub filltemplate ($$) {
# up a template that doesn't work.
return "[[!pagetemplate ".gettext("failed to process template:")." $@]]";
}
- if (! defined $template) {
- return;
- }
$template->param(name => $page);
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 715a3d652..c00aed299 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -336,10 +336,7 @@ sub preprocess_inline (@) {
blind_cache => 1);
};
if ($@) {
- error gettext("failed to process template:")." $@";
- }
- if (! $template) {
- error sprintf(gettext("template %s not found"), $params{template}.".tmpl");
+ error sprintf(gettext("failed to process template %s"), $params{template}.".tmpl").": $@";
}
}
my $needcontent=$raw || (!($archive && $quick) && $template->query(name => 'content'));
diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
index db26bfe31..3df06e652 100644
--- a/IkiWiki/Plugin/template.pm
+++ b/IkiWiki/Plugin/template.pm
@@ -41,12 +41,9 @@ sub preprocess (@) {
blind_cache => 1);
};
if ($@) {
- error gettext("failed to process template:")." $@";
- }
- if (! $template) {
- error sprintf(gettext("%s not found"),
+ error sprintf(gettext("failed to process template %s"),
htmllink($params{page}, $params{destpage},
- "/templates/$params{id}"))
+ "/templates/$params{id}"))." $@";
}
$params{basename}=IkiWiki::basename($params{page});
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index e60314485..d5bd1dd76 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -740,6 +740,8 @@ with no ".tmpl" extension. Template pages are normally looked for in
the templates/ directory. If the page name starts with "/", a page
elsewhere in the wiki can be used.
+If the template is not found, or contains a syntax error, an error is thrown.
+
### `template_depends($$;@)`
Use this instead of `template()` if the content of a template is being