X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/7ae2deacdf5ebf7274da8c77daf42b43aca985c0..4cbb1095d62b9b2ded9546040e4bc5f5b0faef67:/IkiWiki/Plugin/sparkline.pm
diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm
index a44e06252..63c2cf943 100644
--- a/IkiWiki/Plugin/sparkline.pm
+++ b/IkiWiki/Plugin/sparkline.pm
@@ -108,10 +108,6 @@ sub preprocess (@) { #{{{
$php.=qq{\$sparkline->RenderResampled($width, $height);\n};
}
- if ($params{preview}) {
- return "[[".gettext("sparkline previewing not implemented")."]]";
- }
-
$php.=qq{\$sparkline->Output();\n?>\n};
# Use the sha1 of the php code that generates the sparkline as
@@ -148,7 +144,16 @@ sub preprocess (@) { #{{{
return "[[".gettext("sparkline failed to run php")."]]";
}
- writefile($fn, $config{destdir}, $png, 1);
+ if (! $params{preview}) {
+ writefile($fn, $config{destdir}, $png, 1);
+ }
+ else {
+ # can't write the file, so embed it in a data uri
+ eval q{use MIME::Base64};
+ error($@) if $@;
+ return "
";
+ }
}
return '![]('.
)