diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-05-09 00:48:09 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-05-09 00:48:09 +0000 |
commit | 72c53650ad4a708493880daa75cdda9d056fc75e (patch) | |
tree | fa5a977f1b2aca5bde037d74029f069027b9a3bb /IkiWiki/Render.pm | |
parent | 127bceef5b4799e58cb068043e49ed16a3ec840d (diff) | |
download | ikiwiki-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/Render.pm')
-rw-r--r-- | IkiWiki/Render.pm | 21 |
1 files changed, 12 insertions, 9 deletions
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; |