]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/sparkline.pm
* Use forcebaseurl to make page previews be displayed with the html base
[ikiwiki.git] / IkiWiki / Plugin / sparkline.pm
index 425b9826b1ced0704480dcc12ea42bd7a74987c3..0b9ddd8d2460e8ea175a603e710f77ca4589e9e0 100644 (file)
@@ -3,7 +3,7 @@ package IkiWiki::Plugin::sparkline;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 use IPC::Open2;
 
 my $match_num=qr/[-+]?[0-9]+(?:\.[0-9]+)?/;
@@ -114,10 +114,10 @@ sub preprocess (@) { #{{{
        # the base for its filename.
        eval q{use Digest::SHA1};
         error($@) if $@;
-       my $fn=$params{page}."/sparkline-".
+       my $fn=$params{destpage}."/sparkline-".
                IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($php)).
                ".png";
-       will_render($params{page}, $fn);
+       will_render($params{destpage}, $fn);
 
        if (! -e "$config{destdir}/$fn") {
                my $pid;
@@ -156,9 +156,7 @@ sub preprocess (@) { #{{{
                }
        }
 
-       return '<img src="'.
-               IkiWiki::abs2rel($fn, IkiWiki::dirname($params{destpage})).
-               '" alt="graph" />';
+       return '<img src="'.urlto($fn, $params{destpage}).'" alt="graph" />';
 } # }}}
 
 1