]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Revert "Assume that every page has been scanned by the time the scan phase ends"
authorSimon McVittie <smcv@debian.org>
Mon, 8 Jun 2015 22:20:22 +0000 (23:20 +0100)
committerSimon McVittie <smcv@debian.org>
Mon, 8 Jun 2015 22:47:14 +0000 (23:47 +0100)
This reverts commit c04a26f3e70d654ccec5542daf8425e44cb5bac8, which
turns out to break the templatebody directive: readtemplate() relies
on scan() populating %templates, but if scan() is a no-op after
leaving the scan phase, we can't rely on that.

The assumption made by skipping scan() after the end of the render phase
is that everything that comes from a scan is already in the index.
However, we don't really want to put template bodies in the index:
that would force us to load and save them on every refresh, and
redundantly persist them to disk.

Test-case:

% make clean
% ./Makefile.PL
% make
% grep -E '<div class="notebox">|Use this template to' html/sandbox.html
% touch doc/sandbox/New_blog_entry.mdwn          # sandbox inlines this
% make
% grep -E '<div class="notebox">|Use this template to' html/sandbox.html

Good result: html/sandbox.html contains <div class="notebox"> both times

Bad result: html/sandbox.html contains "Use this template to..." the
second time

IkiWiki/Render.pm

index c1a3dcbf272a468cd0df682d7fa2983877984510..632ec980b293cce70869e5dedb0f93249265e884 100644 (file)
@@ -155,7 +155,7 @@ sub genpage ($$) {
 
 sub scan ($) {
        my $file=shift;
-       return if $phase > PHASE_SCAN || $scanned{$file};
+       return if $scanned{$file};
        $scanned{$file}=1;
 
        debug(sprintf(gettext("scanning %s"), $file));
@@ -886,9 +886,6 @@ sub refresh () {
 
        # At this point it becomes OK to start matching pagespecs.
        $phase = PHASE_RENDER;
-       # Save some memory: we no longer need to keep track of which pages
-       # we've scanned
-       %scanned = ();
 
        remove_del(@$del, @$internal_del);