-
- if (! exists $oldpagemtime{$page} ||
- mtime("$config{srcdir}/$file") > $oldpagemtime{$page}) {
- debug("rendering changed file $file");
- render($file);
- $rendered{$file}=1;
+ my ($srcfile, @stat)=srcfile_stat($file);
+ if (! exists $pagemtime{$page} ||
+ $stat[9] > $pagemtime{$page} ||
+ $forcerebuild{$page}) {
+ $pagemtime{$page}=$stat[9];
+ if (isinternal($page)) {
+ push @internal, $file;
+ # Preprocess internal page in scan-only mode.
+ preprocess($page, $page, readfile($srcfile), 1);
+ }
+ else {
+ push @needsbuild, $file;
+ }
+ }
+ }
+ run_hooks(needsbuild => sub { shift->(\@needsbuild) });
+
+ # scan and render 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;
+ }
+ foreach my $file (@internal) {
+ # internal pages are not rendered
+ my $page=pagename($file);
+ delete $depends{$page};
+ foreach my $old (@{$renderedfiles{$page}}) {
+ delete $destsources{$old};