]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/teximg.pm
fixes
[ikiwiki.git] / IkiWiki / Plugin / teximg.pm
index 29c1057f300d2580049218d59a876dfca526eccf..6a6bdd4fa404739789eadd065cad4c8c34e4082f 100644 (file)
@@ -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")
        }
 } #}}}
 
@@ -85,7 +85,7 @@ sub create ($$$) { #{{{
                        .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>";
        }
 } #}}}
 
@@ -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);