X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/34fff64e7b56f4f8cd99430f9f927d2a5d1e3619..b3f7c6a9a579208f555a9ae7a409474d68897d04:/IkiWiki/Plugin/graphviz.pm?ds=sidebyside

diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm
index bec122076..4ed8b89f1 100644
--- a/IkiWiki/Plugin/graphviz.pm
+++ b/IkiWiki/Plugin/graphviz.pm
@@ -37,10 +37,10 @@ sub render_graph (\%) {
 	$src .= "}\n";
 
 	# Use the sha1 of the graphviz code as part of its filename.
-	eval q{use Digest::SHA1};
+	eval q{use Digest::SHA};
 	error($@) if $@;
 	my $dest=$params{page}."/graph-".
-		IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($src)).
+		IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($src)).
 		".png";
 	will_render($params{page}, $dest);
 
@@ -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,".
@@ -79,12 +80,7 @@ sub render_graph (\%) {
 		}
 	}
 
-	if ($params{preview}) {
-		return "<img src=\"".urlto($dest, "")."\" />\n";
-	}
-	else {
-		return "<img src=\"".urlto($dest, $params{destpage})."\" />\n";
-	}
+	return "<img src=\"".urlto($dest, $params{destpage})."\" />\n";
 }
 
 sub graph (@) {