diff options
author | www-data <www-data@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-05-03 20:31:16 +0000 |
---|---|---|
committer | www-data <www-data@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-05-03 20:31:16 +0000 |
commit | 1478bab0cdf13b0a1ed09e5247bada907d245a47 (patch) | |
tree | 923a9f782980a1add146ec18f57847d4bd52a6af /doc/plugins | |
parent | 82594b5f8907f529e3e8056282ff72acece7333f (diff) |
web commit by joey
Diffstat (limited to 'doc/plugins')
-rw-r--r-- | doc/plugins/write.mdwn | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index f9395eb5e..165627f99 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -22,15 +22,33 @@ ikiwiki's processing. The function uses named parameters, and use varies dependi ## Writing a [[PreProcessorDirective]] +This is probably the most common use of a plugin. + IkiWiki::hook(type => "preprocess", id => "foo", call => \&preprocess); Replace "foo" with the command name that will be used inside brackers for the preprocessor directive. -Each time the directive is processed, the referenced subroutine (`preprocess` in the example above) is called, and is passed named parameters. A +Each time the directive is processed, the referenced function (`preprocess` in the example above) is called, and is passed named parameters. A "page" parameter gives the name of the page that embedded the preprocessor directive. All parameters included in the directive are included -as named parameters as well. Whatever the subroutine returns goes onto the +as named parameters as well. Whatever the function returns goes onto the page in place of the directive. +## Other types of hooks + +Beyond PreProcessorDirectives, Other types of hooks that can be used by plugins include: + +### delete + + IkiWiki::hook(type => "delete", id => "foo", call => \&deletion); + +Each time a page or pages is removed from the wiki, the referenced function is called, and passed the names of the source files that were removed. + +### render + + IkiWiki::hook(type => "render", id => "foo", call => \&update); + +Each time ikiwiki renders a change or addition (but not deletion) of a page to the wiki, the referenced function is called, and passed the name of the source file that was rendered. + ## Error handing in plugins While a plugin can call ikiwiki's error routine for a fatal error, for |