aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-09 00:48:09 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-05-09 00:48:09 +0000
commit72c53650ad4a708493880daa75cdda9d056fc75e (patch)
treefa5a977f1b2aca5bde037d74029f069027b9a3bb /IkiWiki
parent127bceef5b4799e58cb068043e49ed16a3ec840d (diff)
downloadikiwiki-72c53650ad4a708493880daa75cdda9d056fc75e.tar
ikiwiki-72c53650ad4a708493880daa75cdda9d056fc75e.tar.gz
* Add the needsbuild hook. Plugins can use this to manipulate which files
ikiwiki builds when refreshing the wiki.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/skeleton.pm5
-rw-r--r--IkiWiki/Render.pm21
2 files changed, 17 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/skeleton.pm b/IkiWiki/Plugin/skeleton.pm
index b8c327c9d..fb4cfe9af 100644
--- a/IkiWiki/Plugin/skeleton.pm
+++ b/IkiWiki/Plugin/skeleton.pm
@@ -11,6 +11,7 @@ use IkiWiki 2.00;
sub import { #{{{
hook(type => "getopt", id => "skeleton", call => \&getopt);
hook(type => "checkconfig", id => "skeleton", call => \&checkconfig);
+ hook(type => "needsbuild", id => "skeleton", call => \&needsbuild);
hook(type => "preprocess", id => "skeleton", call => \&preprocess);
hook(type => "filter", id => "skeleton", call => \&filter);
hook(type => "htmlize", id => "skeleton", call => \&htmlize);
@@ -35,6 +36,10 @@ sub checkconfig () { #{{{
debug("skeleton plugin checkconfig");
} #}}}
+sub needsbuild () { #{{{
+ debug("skeleton plugin needsbuild");
+} #}}}
+
sub preprocess (@) { #{{{
my %params=@_;
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 0b7e00d9d..37383384d 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -318,8 +318,8 @@ sub refresh () { #{{{
}
}
- # scan changed and new files
- my @changed;
+ # find changed and new files
+ my @needsbuild;
foreach my $file (@files) {
my $page=pagename($file);
@@ -327,16 +327,19 @@ sub refresh () { #{{{
if (! exists $pagemtime{$page} ||
$mtime > $pagemtime{$page} ||
$forcerebuild{$page}) {
- debug(sprintf(gettext("scanning %s"), $file));
- $pagemtime{$page}=$mtime;
- push @changed, $file;
- scan($file);
+ $pagemtime{$page}=$mtime;
+ push @needsbuild, $file;
}
}
- calculate_backlinks();
+ run_hooks(needsbuild => sub { shift->(\@needsbuild) });
- # render changed and new pages
- foreach my $file (@changed) {
+ # scan and rendder files
+ foreach my $file (@needsbuild) {
+ debug(sprintf(gettext("scanning %s"), $file));
+ scan($file);
+ }
+ calculate_backlinks();
+ foreach my $file (@needsbuild) {
debug(sprintf(gettext("rendering %s"), $file));
render($file);
$rendered{$file}=1;