aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2014-09-15 21:52:03 +0100
committerSimon McVittie <smcv@debian.org>2014-09-15 21:52:03 +0100
commit7f5c2cfa5a987d887f42d6db95f80f42ceb3b5ff (patch)
tree020a296316b69b723511ff5b327815f81dce3d46 /IkiWiki.pm
parent7660979f74f29560cd91220ade073d4ef2b9bcb0 (diff)
parentc04a26f3e70d654ccec5542daf8425e44cb5bac8 (diff)
downloadikiwiki-7f5c2cfa5a987d887f42d6db95f80f42ceb3b5ff.tar
ikiwiki-7f5c2cfa5a987d887f42d6db95f80f42ceb3b5ff.tar.gz
Merge branch 'ready/templatebody'
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 4ad365c1d..d5d11ee85 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -14,7 +14,7 @@ use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
%pagestate %wikistate %renderedfiles %oldrenderedfiles
%pagesources %delpagesources %destsources %depends %depends_simple
@mass_depends %hooks %forcerebuild %loaded_plugins %typedlinks
- %oldtypedlinks %autofiles @underlayfiles $lastrev};
+ %oldtypedlinks %autofiles @underlayfiles $lastrev $phase};
use Exporter q{import};
our @EXPORT = qw(hook debug error htmlpage template template_depends
@@ -34,6 +34,11 @@ our $DEPEND_CONTENT=1;
our $DEPEND_PRESENCE=2;
our $DEPEND_LINKS=4;
+# Phases of processing.
+sub PHASE_SCAN () { 0 }
+sub PHASE_RENDER () { 1 }
+$phase = PHASE_SCAN;
+
# Optimisation.
use Memoize;
memoize("abs2rel");
@@ -152,7 +157,8 @@ sub getsetup () {
type => "internal",
default => [qw{mdwn link inline meta htmlscrubber passwordauth
openid signinedit lockedit conditional
- recentchanges parentlinks editpage}],
+ recentchanges parentlinks editpage
+ templatebody}],
description => "plugins to enable by default",
safe => 0,
rebuild => 1,
@@ -2022,11 +2028,19 @@ sub template_depends ($$;@) {
if (defined $page && defined $tpage) {
add_depends($page, $tpage);
}
-
+
my @opts=(
filter => sub {
my $text_ref = shift;
${$text_ref} = decode_utf8(${$text_ref});
+ run_hooks(readtemplate => sub {
+ ${$text_ref} = shift->(
+ id => $name,
+ page => $tpage,
+ content => ${$text_ref},
+ untrusted => $untrusted,
+ );
+ });
},
loop_context_vars => 1,
die_on_bad_params => 0,