From: Simon McVittie <smcv@debian.org>
Date: Fri, 13 Sep 2013 08:14:24 +0000 (+0100)
Subject: IkiWiki::Render: make 'scan' idempotent
X-Git-Tag: 3.20140916~10^2~5
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/cad753baf9b25ddd8e4cb5454766fce1cdc4217a?ds=inline

IkiWiki::Render: make 'scan' idempotent

If it does nothing when a page has already been scanned, we can use it
at any time to force a page to be scanned. In particular, the
templatebody plugin is going to need this.
---

diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index fa2940b01..9e93534c6 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -6,7 +6,7 @@ use warnings;
 use strict;
 use IkiWiki;
 
-my (%backlinks, %rendered);
+my (%backlinks, %rendered, %scanned);
 our %brokenlinks;
 my $links_calculated=0;
 
@@ -154,6 +154,8 @@ sub genpage ($$) {
 
 sub scan ($) {
 	my $file=shift;
+	return if $scanned{$file};
+	$scanned{$file}=1;
 
 	debug(sprintf(gettext("scanning %s"), $file));