X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/055179cb4cc9b8bc9b204e1a9f83b1f59e13824e..ea766fcf497b79a73bcf94371da9cd677fc9138f:/doc/plugins/write.mdwn diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 1cb26a076..0da425402 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -123,7 +123,9 @@ An optional "scan" parameter, if set to a true value, makes the hook be called during the preliminary scan that ikiwiki makes of updated pages, before begining to render pages. This parameter should be set to true if the hook modifies data in `%links`. Note that doing so will make the hook -be run twice per page build, so avoid doing it for expensive hooks. +be run twice per page build, so avoid doing it for expensive hooks. (As an +optimisation, if your preprocessor hook is called in a void contets, you +can assume it's being run in scan mode.) Note that if the [[htmlscrubber]] is enabled, html in [[ikiwiki/PreProcessorDirective]] output is sanitised, which may limit what @@ -246,10 +248,16 @@ a page can be edited using the web interface (commits from revision control bypass it). When a page is edited, each registered canedit hook is called in turn, and passed the page name, a CGI object, and a session object. -If edit can proceed, the hook should return "". If the edit is not allowed -by this hook, the hook should return an error message for the user to see. If the hook has no opinion about whether the edit can proceed, return -`undef`, and the next plugin will be asked to decide. +`undef`, and the next plugin will be asked to decide. If edit can proceed, +the hook should return "". If the edit is not allowed by this hook, the +hook should return an error message for the user to see, or a function +that can be run to log the user in or perform other action necessary for +them to be able to edit the page. + +This hook should avoid directly redirecting the user to a signin page, +since it's sometimes used to test to see which pages in a set of pages a +user can edit. ### editcontent @@ -279,10 +287,8 @@ it's a form that it needs to modify, will call various methods to add/remove/change fields, tweak the validation code for the fields, etc. It will not validate or display the form. -Form validation and display can be overridden by the formbuilder hook. -By default, ikiwiki will do a basic validation and display of the form, -but if this hook is registered, it will stop that and let the hook take -over. +Just before a form is displayed to the user, the `formbuilder` hook is +called. It can be used to validate the form, but should not display it. ### savestate @@ -327,6 +333,9 @@ used. When pages are deleted, ikiwiki automatically deletes their pagestate too. +Note that page state does not persist across wiki rebuilds, only across +wiki updates. + ### Other variables If your plugin needs to access data about other pages in the wiki. It can