X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/a65d312467c5ab179ecf4aa715790f371a46634a..69c22fa1ea143e3eb36692e087b167ae2171581e:/IkiWiki/Plugin/pagetemplate.pm diff --git a/IkiWiki/Plugin/pagetemplate.pm b/IkiWiki/Plugin/pagetemplate.pm index 205f5a9d7..1d8a84ca7 100644 --- a/IkiWiki/Plugin/pagetemplate.pm +++ b/IkiWiki/Plugin/pagetemplate.pm @@ -3,16 +3,25 @@ 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} || @@ -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