aboutsummaryrefslogtreecommitdiff
path: root/doc/plugins/write.mdwn
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 /doc/plugins/write.mdwn
parent7660979f74f29560cd91220ade073d4ef2b9bcb0 (diff)
parentc04a26f3e70d654ccec5542daf8425e44cb5bac8 (diff)
downloadikiwiki-7f5c2cfa5a987d887f42d6db95f80f42ceb3b5ff.tar
ikiwiki-7f5c2cfa5a987d887f42d6db95f80f42ceb3b5ff.tar.gz
Merge branch 'ready/templatebody'
Diffstat (limited to 'doc/plugins/write.mdwn')
-rw-r--r--doc/plugins/write.mdwn23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index d2d1a6329..15f054c09 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -211,6 +211,29 @@ them to `%links`. Present in IkiWiki 2.40 and later.
The function is passed named parameters "page" and "content". Its return
value is ignored.
+### <a name="readtemplate">readtemplate</a>
+
+ hook(type => "readtemplate", id => "foo", call => \&readtemplate);
+
+Runs on the raw source of a page or `*.tmpl` file that is being
+used as a template, before it is parsed by [[!cpan HTML::Template]].
+For instance, the [[plugins/templatebody]] plugin uses this to return
+the content of the [[ikiwiki/directive/templatebody]] directive (if there
+is one) instead of the page's full content.
+
+The function is passed named parameters:
+
+* `id`: the name under which the template was looked up,
+ such as `page.tmpl` or `note`
+* `page`: the name of the template as a page or attachment in the wiki,
+ such as `templates/note`, or `undef` if it's outside the wiki (e.g. in
+ `/usr/share/ikiwiki/templates`)
+* `content`: the content of the corresponding file
+* `untrusted`: true if the template was loaded from the wiki or an underlay,
+ false if it was loaded from a trusted location
+
+It should return the replacement content.
+
### <a name="filter">filter</a>
hook(type => "filter", id => "foo", call => \&filter);