]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - math/render.ml
MediaWiki 1.16.0
[autoinstalls/mediawiki.git] / math / render.ml
index 67ecab8d0eb966202f1b46b91dc647946c1381a0..f16735554e915cf49ff80d578c9e8ba16a1f3b6d 100644 (file)
@@ -5,11 +5,11 @@ let cmd_convert tmpprefix finalpath = "convert -quality 100 -density 120 " ^ tmp
 (* Putting -bg Transparent in dvipng's arguments will give full-alpha transparency *)
 (* Note that IE have problems with such PNGs and need an additional javascript snippet *)
 (* Putting -bg transparent in dvipng's arguments will give binary transparency *)
-let cmd_dvipng tmpprefix finalpath = "dvipng -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
+let cmd_dvipng tmpprefix finalpath backcolor = "dvipng -bg \'" ^ backcolor ^ "\' -gamma 1.5 -D 120 -T tight --strict " ^ tmpprefix ^ ".dvi -o " ^ finalpath ^ " >/dev/null 2>/dev/null"
 
 exception ExternalCommandFailure of string
 
-let render tmppath finalpath outtex md5 =
+let render tmppath finalpath outtex md5 backcolor =
     let tmpprefix0 = (string_of_int (Unix.getpid ()))^"_"^md5 in
     let tmpprefix = (tmppath^"/"^tmpprefix0) in
     let unlink_all () =
@@ -30,7 +30,7 @@ let render tmppath finalpath outtex md5 =
        close_out f;
        if Util.run_in_other_directory tmppath (cmd_latex tmpprefix0) != 0
        then (unlink_all (); raise (ExternalCommandFailure "latex"))
-       else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png")) != 0)
+       else if (Sys.command (cmd_dvipng tmpprefix (finalpath^"/"^md5^".png") backcolor) != 0)
        then (if (Sys.command (cmd_dvips tmpprefix) != 0)
        then (unlink_all (); raise (ExternalCommandFailure "dvips"))
        else if (Sys.command (cmd_convert tmpprefix (finalpath^"/"^md5^".png")) != 0)