X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/mediawiki.git/blobdiff_plain/74c929b24b048c9f1e31e17db757ae4195cd7673..d75ce11339b35963b5f8c3d53190819c1c025716:/math/render.ml diff --git a/math/render.ml b/math/render.ml index 67ecab8d..f1673555 100644 --- a/math/render.ml +++ b/math/render.ml @@ -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)