X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/f7bdc2385d3ec8060f00d5ceb3b45f3cc4760e38..0d7bc7402c9a5e922ee3eb1b093e689756b001ff:/IkiWiki/Plugin/teximg.pm?ds=sidebyside
diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm
index f7fd91ddf..6a6bdd4fa 100644
--- a/IkiWiki/Plugin/teximg.pm
+++ b/IkiWiki/Plugin/teximg.pm
@@ -27,14 +27,14 @@ sub preprocess (@) { #{{{
my $code = $params{code};
if (! defined $code && ! length $code) {
- return "[[teximg ".gettext("missing tex code"). "]]";
+ error gettext("missing tex code");
}
if (check($code)) {
return create($code, check_height($height), \%params);
}
else {
- return "[[teximg ".gettext("code includes disallowed latex commands"). "]]";
+ error gettext("code includes disallowed latex commands")
}
} #}}}
@@ -70,13 +70,13 @@ sub create ($$$) { #{{{
my $digest = md5_hex($code, $height);
- my $imglink= $params->{destpage} . "/$digest.png";
- my $imglog = $params->{destpage} . "/$digest.log";
- will_render($params->{destpage}, $imglink);
- will_render($params->{destpage}, $imglog);
+ my $imglink= $params->{page} . "/$digest.png";
+ my $imglog = $params->{page} . "/$digest.log";
+ will_render($params->{page}, $imglink);
+ will_render($params->{page}, $imglog);
my $imgurl=urlto($imglink, $params->{destpage});
- my $logurl=urlto($imglink, $params->{destpage});
+ my $logurl=urlto($imglog, $params->{destpage});
if (-e "$config{destdir}/$imglink" ||
gen_image($code, $height, $digest, $params->{page})) {
@@ -85,7 +85,7 @@ sub create ($$$) { #{{{
.qq{" class="teximg" />};
}
else {
- return qq{[[teximg }.gettext("failed to generate image from code")."]]";
+ error qq{}.gettext("failed to generate image from code")."";
}
} #}}}
@@ -119,12 +119,13 @@ sub gen_image ($$$$) { #{{{
}
else {
# store failure log
- my $log;
+ my $log="";
{
- open(my $f, '<', "$tmp/$digest.log");
- local $/=undef;
- $log = <$f>;
- close($f);
+ if (open(my $f, '<', "$tmp/$digest.log")) {
+ local $/=undef;
+ $log = <$f>;
+ close($f);
+ }
}
writefile("$digest.log", "$config{destdir}/$imagedir", $log);