]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/graphviz.pm
Merge branch 'master' of ssh://git.ikiwiki.info/srv/git/ikiwiki.info
[git.ikiwiki.info.git] / IkiWiki / Plugin / graphviz.pm
index b43e96a73adad4b1b8091c689110c70611a983f6..dfd66a03e2250723132caa75c2f9d5da2e2c4fc2 100644 (file)
@@ -18,6 +18,7 @@ sub getsetup () {
                plugin => {
                        safe => 1,
                        rebuild => undef,
                plugin => {
                        safe => 1,
                        rebuild => undef,
+                       section => "widget",
                },
 }
 
                },
 }
 
@@ -45,7 +46,7 @@ sub render_graph (\%) {
 
        if (! -e "$config{destdir}/$dest") {
                my $pid;
 
        if (! -e "$config{destdir}/$dest") {
                my $pid;
-               my $sigpipe=0;;
+               my $sigpipe=0;
                $SIG{PIPE}=sub { $sigpipe=1 };
                $pid=open2(*IN, *OUT, "$params{prog} -Tpng");
 
                $SIG{PIPE}=sub { $sigpipe=1 };
                $pid=open2(*IN, *OUT, "$params{prog} -Tpng");
 
@@ -70,7 +71,8 @@ sub render_graph (\%) {
                        writefile($dest, $config{destdir}, $png, 1);
                }
                else {
                        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,".
                        eval q{use MIME::Base64};
                        error($@) if $@;
                        return "<img src=\"data:image/png;base64,".
@@ -78,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 (@) {
 }
 
 sub graph (@) {