X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/21bb9de4964a8d58355606213d94fa570b1a5af3..5dde5c7bc81752004c434ab9a8d9e87613078f52:/doc/plugins/write.mdwn diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 25ea8a98e..90818c42e 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -128,17 +128,28 @@ return the htmlized content. hook(type => "pagetemplate", id => "foo", call => \&pagetemplate); -[[Templates]] are filled out for many different things in ikiwiki, like -generating a page, or part of a blog page, or an rss feed, or a cgi. This -hook allows modifying those templates. The function is passed named -parameters. The "page" and "destpage" parameters are the same as for a -preprocess hook. The "template" parameter is a [[cpan HTML::Template]] -object that is the template that will be used to generate the page. The -function can manipulate that template object. +[[Templates|wikitemplate]] are filled out for many different things in +ikiwiki, like generating a page, or part of a blog page, or an rss feed, or +a cgi. This hook allows modifying the variables available on those +templates. The function is passed named parameters. The "page" and +"destpage" parameters are the same as for a preprocess hook. The "template" +parameter is a [[cpan HTML::Template]] object that is the template that +will be used to generate the page. The function can manipulate that +template object. The most common thing to do is probably to call `$template->param()` to add a new custom parameter to the template. +### templatefile + + hook(type => "templatefile", id => "foo", call => \&templatefile); + +This hook allows plugins to change the [[template|wikitemplate]] that is +used for a page in the wiki. The hook is passed a "page" parameter, and +should return the name of the template file to use, or undef if it doesn't +want to change the default ("page.tmpl"). Template files are looked for in +/usr/share/ikiwiki/templates by default. + ### sanitize hook(type => "sanitize", id => "foo", call => \&sanitize); @@ -181,7 +192,7 @@ source files that were rendered. Use this to hook into ikiwiki's cgi script. Each registered cgi hook is called in turn, and passed a CGI object. The hook should examine the -parameters, and if it will handle this CGI request, output a page and +parameters, and if it will handle this CGI request, output a page (including the http headers) and terminate the program. ### auth @@ -361,6 +372,7 @@ control some options. These are: * forcesubpage - set to force a link to a subpage * linktext - set to force the link text to something * anchor - set to make the link include an anchor +* rel - set to add a rel attribute to the link. #### `readfile($;$)` @@ -422,7 +434,9 @@ This is the standard gettext function, although slightly optimised. #### `urlto($$)` -Construct a relative url to the first parameter from the second. +Construct a relative url to the first parameter from the page named by the +second. The first parameter can be either a page name, or some other +destination file, as registered by `will_render`. #### `targetpage($$)`