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")
}
} #}}}
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})) {
.qq{" class="teximg" />};
}
else {
- return qq{[[teximg <a href="$logurl">}.gettext("failed to generate image from code")."</a>]]";
+ error qq{<a href="$logurl">}.gettext("failed to generate image from code")."</a>";
}
} #}}}
}
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);