X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/1d61c4d4d690624f6d6fb34b6decd5507a003298..d3c15aed18ef9e67c3e785ac3cc0426c56e59ac7:/IkiWiki/Plugin/pagetemplate.pm

diff --git a/IkiWiki/Plugin/pagetemplate.pm b/IkiWiki/Plugin/pagetemplate.pm
index 69a2433a8..1d8a84ca7 100644
--- a/IkiWiki/Plugin/pagetemplate.pm
+++ b/IkiWiki/Plugin/pagetemplate.pm
@@ -3,22 +3,31 @@ package IkiWiki::Plugin::pagetemplate;
 
 use warnings;
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 
 my %templates;
 
-sub import { #{{{
+sub import {
+	hook(type => "getsetup", id => "pagetemplate", call => \&getsetup);
 	hook(type => "preprocess", id => "pagetemplate", call => \&preprocess);
 	hook(type => "templatefile", id => "pagetemplate", call => \&templatefile);
-} # }}}
+}
 
-sub preprocess (@) { #{{{
+sub getsetup () {
+	return 
+		plugin => {
+			safe => 1,
+			rebuild => undef,
+		},
+}
+
+sub preprocess (@) {
 	my %params=@_;
 
 	if (! exists $params{template} ||
 	    $params{template} !~ /^[-A-Za-z0-9._+]+$/ ||
 	    ! defined IkiWiki::template_file($params{template})) {
-		 return "[[pagetemplate ".gettext("bad or missing template")."]]";
+		 error gettext("bad or missing template")
 	}
 
 	if ($params{page} eq $params{destpage}) {
@@ -26,9 +35,9 @@ sub preprocess (@) { #{{{
 	}
 
 	return "";
-} # }}}
+}
 
-sub templatefile (@) { #{{{
+sub templatefile (@) {
 	my %params=@_;
 
 	if (exists $templates{$params{page}}) {
@@ -36,6 +45,6 @@ sub templatefile (@) { #{{{
 	}
 	
 	return undef;
-} # }}}
+}
 
 1