rename the "render" hook to "change", which is clearer
parent
13f8a835a0
commit
157df8591f
|
@ -11,8 +11,8 @@ sub import { #{{{
|
||||||
call => \&checkconfig);
|
call => \&checkconfig);
|
||||||
IkiWiki::hook(type => "delete", id => "hyperestraier",
|
IkiWiki::hook(type => "delete", id => "hyperestraier",
|
||||||
call => \&delete);
|
call => \&delete);
|
||||||
IkiWiki::hook(type => "render", id => "hyperestraier",
|
IkiWiki::hook(type => "change", id => "hyperestraier",
|
||||||
call => \&render);
|
call => \&change);
|
||||||
IkiWiki::hook(type => "cgi", id => "hyperestraier",
|
IkiWiki::hook(type => "cgi", id => "hyperestraier",
|
||||||
call => \&cgi);
|
call => \&cgi);
|
||||||
} # }}}
|
} # }}}
|
||||||
|
@ -41,7 +41,7 @@ sub delete (@) { #{{{
|
||||||
IkiWiki::estcfg();
|
IkiWiki::estcfg();
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub render (@) { #{{{
|
sub change (@) { #{{{
|
||||||
IkiWiki::debug("updating hyperestraier search index");
|
IkiWiki::debug("updating hyperestraier search index");
|
||||||
IkiWiki::estcmd("gather -cm -bc -cl -sd",
|
IkiWiki::estcmd("gather -cm -bc -cl -sd",
|
||||||
map {
|
map {
|
||||||
|
|
|
@ -17,8 +17,8 @@ sub import { #{{{
|
||||||
call => \&filter);
|
call => \&filter);
|
||||||
IkiWiki::hook(type => "delete", id => "skeleton",
|
IkiWiki::hook(type => "delete", id => "skeleton",
|
||||||
call => \&delete);
|
call => \&delete);
|
||||||
IkiWiki::hook(type => "render", id => "skeleton",
|
IkiWiki::hook(type => "change", id => "skeleton",
|
||||||
call => \&render);
|
call => \&change);
|
||||||
IkiWiki::hook(type => "cgi", id => "skeleton",
|
IkiWiki::hook(type => "cgi", id => "skeleton",
|
||||||
call => \&cgi);
|
call => \&cgi);
|
||||||
} # }}}
|
} # }}}
|
||||||
|
@ -47,10 +47,10 @@ sub delete (@) { #{{{
|
||||||
IkiWiki::debug("skeleton plugin told that files were deleted: @files");
|
IkiWiki::debug("skeleton plugin told that files were deleted: @files");
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub render (@) { #{{{
|
sub change (@) { #{{{
|
||||||
my @files=@_;
|
my @files=@_;
|
||||||
|
|
||||||
IkiWiki::debug("skeleton plugin told that files were rendered: @files");
|
IkiWiki::debug("skeleton plugin told that changed files were rendered: @files");
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub cgi ($) { #{{{
|
sub cgi ($) { #{{{
|
||||||
|
|
|
@ -477,9 +477,9 @@ FILE: foreach my $file (@files) {
|
||||||
$hooks{delete}{$id}{call}->(@del);
|
$hooks{delete}{$id}{call}->(@del);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (%rendered && exists $hooks{render}) {
|
if (%rendered && exists $hooks{change}) {
|
||||||
foreach my $id (keys %{$hooks{render}}) {
|
foreach my $id (keys %{$hooks{change}}) {
|
||||||
$hooks{render}{$id}{call}->(keys %rendered);
|
$hooks{change}{$id}{call}->(keys %rendered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -52,7 +52,8 @@ return the error message as the output of the plugin.
|
||||||
Note that if [[HTMLSanitization]] is enabled, html in
|
Note that if [[HTMLSanitization]] is enabled, html in
|
||||||
[[PreProcessorDirective]] output is sanitised, which may limit what your
|
[[PreProcessorDirective]] output is sanitised, which may limit what your
|
||||||
plugin can do. Also, the rest of the page content is not in html format at
|
plugin can do. Also, the rest of the page content is not in html format at
|
||||||
preprocessor time. Text output by a preprocessor directive will be passed through markdown along with the rest of the page.
|
preprocessor time. Text output by a preprocessor directive will be passed
|
||||||
|
through markdown along with the rest of the page.
|
||||||
|
|
||||||
## Other types of hooks
|
## Other types of hooks
|
||||||
|
|
||||||
|
@ -83,13 +84,13 @@ make arbitrary changes. The function is passed named parameters `page` and
|
||||||
Each time a page or pages is removed from the wiki, the referenced function
|
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.
|
is called, and passed the names of the source files that were removed.
|
||||||
|
|
||||||
### render
|
### change
|
||||||
|
|
||||||
IkiWiki::hook(type => "render", id => "foo", call => \&render);
|
IkiWiki::hook(type => "change", id => "foo", call => \&render);
|
||||||
|
|
||||||
Each time ikiwiki renders a change or addition (but not deletion) of a page
|
Each time ikiwiki renders a change or addition (but not deletion) to the
|
||||||
to the wiki, the referenced function is called, and passed the name of the
|
wiki, the referenced function is called, and passed the names of the
|
||||||
source file that was rendered.
|
source files that were rendered.
|
||||||
|
|
||||||
### cgi
|
### cgi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue