diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-03-12 14:21:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-03-12 14:21:48 -0400 |
commit | f7bdc2385d3ec8060f00d5ceb3b45f3cc4760e38 (patch) | |
tree | 852afeedb432084b4832263087a706a4e7bde408 /IkiWiki/Plugin | |
parent | be0f1a63a3ebd05967a8bc6b03a425a2118b17c4 (diff) | |
download | ikiwiki-f7bdc2385d3ec8060f00d5ceb3b45f3cc4760e38.tar ikiwiki-f7bdc2385d3ec8060f00d5ceb3b45f3cc4760e38.tar.gz |
* Use forcebaseurl to make page previews be displayed with the html base
set to the destination page. This avoids need for hacks to munge the urls
in preview mode, which fixes several bugs.
* Several destpage fixes in plugins.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/graphviz.pm | 6 | ||||
-rw-r--r-- | IkiWiki/Plugin/img.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/linkmap.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/sparkline.pm | 4 | ||||
-rw-r--r-- | IkiWiki/Plugin/teximg.pm | 16 |
5 files changed, 13 insertions, 21 deletions
diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index fb3239227..ec48bad2c 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -29,10 +29,10 @@ sub render_graph (\%) { #{{{ # Use the sha1 of the graphviz code as part of its filename. eval q{use Digest::SHA1}; error($@) if $@; - my $dest=$params{page}."/graph-". + my $dest=$params{destpage}."/graph-". IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($src)). ".png"; - will_render($params{page}, $dest); + will_render($params{destpage}, $dest); if (! -e "$config{destdir}/$dest") { my $pid; @@ -73,7 +73,7 @@ sub render_graph (\%) { #{{{ return "<img src=\"".urlto($dest, "")."\" />\n"; } else { - return "<img src=\"".urlto($dest, $params{page})."\" />\n"; + return "<img src=\"".urlto($dest, $params{destpage})."\" />\n"; } } #}}} diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index b6e7c9e41..c5b86bad8 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -39,7 +39,7 @@ sub preprocess (@) { #{{{ my $file = bestlink($params{page}, $image); - my $dir = $params{page}; + my $dir = $params{destpage}; my $base = IkiWiki::basename($file); eval q{use Image::Magick}; @@ -56,7 +56,7 @@ sub preprocess (@) { #{{{ my $outfile = "$config{destdir}/$dir/${w}x${h}-$base"; $imglink = "$dir/${w}x${h}-$base"; - will_render($params{page}, $imglink); + will_render($params{destpage}, $imglink); if (-e $outfile && (-M srcfile($file) >= -M $outfile)) { $r = $im->Read($outfile); diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 62984d9b8..5b87277ac 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -53,11 +53,11 @@ sub genmap ($) { #{{{ } } - my $dest=$params{page}."/linkmap.png"; + my $dest=$params{destpage}."/linkmap.png"; # Use ikiwiki's function to create the file, this makes sure needed # subdirs are there and does some sanity checking. - will_render($params{page}, $dest); + will_render($params{destpage}, $dest); writefile($dest, $config{destdir}, ""); # Run dot to create the graphic and get the map data. diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index 69b3512c2..0b9ddd8d2 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -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; diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 5dff5feef..f7fd91ddf 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -70,21 +70,13 @@ sub create ($$$) { #{{{ my $digest = md5_hex($code, $height); - my $imglink= $params->{page} . "/$digest.png"; - my $imglog = $params->{page} . "/$digest.log"; + my $imglink= $params->{destpage} . "/$digest.png"; + my $imglog = $params->{destpage} . "/$digest.log"; will_render($params->{destpage}, $imglink); will_render($params->{destpage}, $imglog); - my $imgurl; - my $logurl; - if (! $params->{preview}) { - $imgurl = urlto($imglink, $params->{destpage}); - $logurl = urlto($imglog, $params->{destpage}); - } - else { - $imgurl=$params->{page}."/$digest.png"; - $logurl=$params->{page}."/$digest.log"; - } + my $imgurl=urlto($imglink, $params->{destpage}); + my $logurl=urlto($imglink, $params->{destpage}); if (-e "$config{destdir}/$imglink" || gen_image($code, $height, $digest, $params->{page})) { |