X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/4745391360cf0843e376676479fee306d0a8312d..89000b48f3cb809b13aa64db79abb90d446458b9:/doc/plugins/write.mdwn diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index b7c487ee2..216cfa51c 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -82,11 +82,19 @@ configuration. It's called early in the startup process. The function is passed no values. It's ok for the function to call `error()` if something isn't configured right. +### refresh + + hook(type => "refresh", id => "foo", call => \&refresh); + +This hook is called just before ikiwiki scans the wiki for changed files. +It's useful for plugins that need to create or modify a source page. The +function is passed no values. + ### needsbuild hook(type => "needsbuild", id => "foo", call => \&needsbuild); -This allows a plugin the manipulate the list of files that need to be +This allows a plugin to manipulate the list of files that need to be built when the wiki is refreshed. The function is passed a reference to an array of pages that will be rebuilt, and can modify the array, either adding or removing files from it. @@ -123,7 +131,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 @@ -212,8 +222,11 @@ 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 (including the http headers) and -terminate the program. +parameters, and if it will handle this CGI request, output a page +(including the http headers) and terminate the program. + +Note that cgi hooks are called as early as possible, before any ikiwiki +state is loaded, and with no session information. ### auth @@ -246,10 +259,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 @@ -325,6 +344,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 @@ -512,6 +534,19 @@ destination file, as registered by `will_render`. Passed a page and an extension, returns the filename that page will be rendered to. +## Internal use pages + +Sometimes it's useful to put pages in the wiki without the overhead of +having them be rendered to individual html files. Such internal use pages +are collected together to form the RecentChanges page, for example. + +To make an internal use page, register a filename extension that starts +with "_". Internal use pages cannot be edited with the web interface, +generally shouldn't contain wikilinks or preprocessor directives (use +either on them with extreme caution), and are not matched by regular +PageSpecs glob patterns, but instead only by a special `internal()` +[[ikiwiki/PageSpec]]. + ## RCS plugins ikiwiki's support for [[revision_control_systems|rcs]] also uses pluggable