From: Joey Hess <joey@kitenet.net>
Date: Wed, 9 Jun 2010 21:43:20 +0000 (-0400)
Subject: improve preview mode comments
X-Git-Tag: 3.20100610~11
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/b2327cfae4ac7da1df7bbf848f575b553f74eafb?ds=inline;hp=-c

improve preview mode comments
---

b2327cfae4ac7da1df7bbf848f575b553f74eafb
diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm
index c91c92fec..dfd66a03e 100644
--- a/IkiWiki/Plugin/graphviz.pm
+++ b/IkiWiki/Plugin/graphviz.pm
@@ -71,7 +71,8 @@ sub render_graph (\%) {
 			writefile($dest, $config{destdir}, $png, 1);
 		}
 		else {
-			# can't write the file, so embed it in a data uri
+			# in preview mode, embed the image in a data uri
+			# to avoid temp file clutter
 			eval q{use MIME::Base64};
 			error($@) if $@;
 			return "<img src=\"data:image/png;base64,".
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 63dfa9019..48211454e 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -121,7 +121,8 @@ sub preprocess (@) {
 				$r = $im->Resize(geometry => "${w}x${h}");
 				error sprintf(gettext("failed to resize: %s"), $r) if $r;
 
-				# don't actually write file in preview mode
+				# don't actually write resized file in preview mode;
+				# rely on width and height settings
 				if (! $params{preview}) {
 					my @blob = $im->ImageToBlob();
 					writefile($imglink, $config{destdir}, $blob[0], 1);
diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm
index 42665ac63..1b1d04cba 100644
--- a/IkiWiki/Plugin/sparkline.pm
+++ b/IkiWiki/Plugin/sparkline.pm
@@ -158,7 +158,8 @@ sub preprocess (@) {
 			writefile($fn, $config{destdir}, $png, 1);
 		}
 		else {
-			# can't write the file, so embed it in a data uri
+			# in preview mode, embed the image in a data uri
+			# to avoid temp file clutter
 			eval q{use MIME::Base64};
 		        error($@) if $@;
 			return "<img src=\"data:image/png;base64,".