]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
Add templatebody plugin and directive, and enable it by default
[ikiwiki.git] / IkiWiki.pm
index e5da04a3bb86d8aa47d96cac3df679623ad707ee..d8cfc31ccb972b5ee615cb041ad64fbeca38cc52 100644 (file)
@@ -152,7 +152,8 @@ sub getsetup () {
                type => "internal",
                default => [qw{mdwn link inline meta htmlscrubber passwordauth
                                openid signinedit lockedit conditional
                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,
                description => "plugins to enable by default",
                safe => 0,
                rebuild => 1,
@@ -2021,11 +2022,19 @@ sub template_depends ($$;@) {
        if (defined $page && defined $tpage) {
                add_depends($page, $tpage);
        }
        if (defined $page && defined $tpage) {
                add_depends($page, $tpage);
        }
-       
+
        my @opts=(
                filter => sub {
                        my $text_ref = shift;
                        ${$text_ref} = decode_utf8(${$text_ref});
        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,
                },
                loop_context_vars => 1,
                die_on_bad_params => 0,