From a654a72fda2be74857a9b8074eb0c2f944907b69 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Wed, 9 Jan 2008 02:31:11 -0500
Subject: optimisation: detect scan mode and avoid generating image

---
 IkiWiki/Plugin/img.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 88a3d7b4d..b6e7c9e41 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -32,6 +32,11 @@ sub preprocess (@) { #{{{
 	}
 
 	push @{$links{$params{page}}}, $image;
+	# optimisation: detect scan mode, and avoid generating the image
+	if (! defined wantarray) {
+		return;
+	}
+
 	my $file = bestlink($params{page}, $image);
 
 	my $dir = $params{page};
-- 
cgit v1.2.3