]> sipb.mit.edu Git - ikiwiki.git/commitdiff
web commit by joey
authorwww-data <www-data@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 3 May 2006 20:31:16 +0000 (20:31 +0000)
committerwww-data <www-data@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Wed, 3 May 2006 20:31:16 +0000 (20:31 +0000)
doc/plugins/write.mdwn

index f9395eb5ea330805c047187ed72dc598585cd09b..165627f99fc0d7c71380fc706e0e2aa75474d2a4 100644 (file)
@@ -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