summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
commit222b01f5169f1c7e69762e0e8904c24f78f71882 (patch)
tree8e932e12546bb991357ec48eb1638d1770be7a35 /math
parent00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff)
update to MediaWiki 1.16.0
Diffstat (limited to 'math')
-rw-r--r--math/README4
-rw-r--r--math/render.ml6
-rw-r--r--math/texutil.ml4
-rw-r--r--math/texvc.ml6
4 files changed, 11 insertions, 9 deletions
diff --git a/math/README b/math/README
index 069be750..d0e21648 100644
--- a/math/README
+++ b/math/README
@@ -48,13 +48,13 @@ Just Works. It can be run manually for testing or for use in another app.
=== Command-line parameters ===
- texvc <temp directory> <output directory> <TeX code> <encoding>
+ texvc <temp directory> <output directory> <TeX code> <encoding> <color>
Be sure to properly quote the TeX code!
Example:
- texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1
+ texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0"
=== Output format ===
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)
diff --git a/math/texutil.ml b/math/texutil.ml
index 7355bd64..ad4fce10 100644
--- a/math/texutil.ml
+++ b/math/texutil.ml
@@ -481,7 +481,7 @@ let find = function
| "\\underbrace" -> LITERAL (TEX_ONLY "\\underbrace ")
| "\\overleftarrow" -> LITERAL (TEX_ONLY "\\overleftarrow ")
| "\\overrightarrow" -> LITERAL (TEX_ONLY "\\overrightarrow ")
- | "\\overleftrightarrow"->LITERAL (TEX_ONLY "\\overleftrightarrow ")
+ | "\\overleftrightarrow"-> (tex_use_ams(); LITERAL (TEX_ONLY "\\overleftrightarrow "))
| "\\check" -> FUN_AR1 "\\check "
| "\\acute" -> FUN_AR1 "\\acute "
| "\\grave" -> FUN_AR1 "\\grave "
@@ -733,4 +733,6 @@ let find = function
| "\\vbox" -> raise (Failure "malformatted \\vbox")
| "\\hbox" -> raise (Failure "malformatted \\hbox")
| "\\color" -> (tex_use_color (); LITERAL (TEX_ONLY "\\color"))
+ | "\\pagecolor" -> (tex_use_color (); LITERAL (TEX_ONLY "\\pagecolor"))
+ | "\\definecolor" -> (tex_use_color (); LITERAL (TEX_ONLY "\\definecolor"))
| s -> raise (Illegal_tex_function s)
diff --git a/math/texvc.ml b/math/texvc.ml
index abddd3d0..38a7e93b 100644
--- a/math/texvc.ml
+++ b/math/texvc.ml
@@ -3,7 +3,7 @@ let lexer_token_safe lexbuf =
try Lexer.token lexbuf
with Failure s -> raise (LexerException s)
-let render tmppath finalpath tree =
+let render tmppath finalpath tree backcolor =
let outtex = Util.mapjoin Texutil.render_tex tree in
let md5 = Digest.to_hex (Digest.string outtex) in
begin
@@ -19,11 +19,11 @@ let render tmppath finalpath tree =
| Some h,Html.LIBERAL,Some m -> "L" ^ md5 ^ h ^ "\000" ^ m
| None,_,Some m -> "X" ^ md5 ^ m
);
- Render.render tmppath finalpath outtex md5
+ Render.render tmppath finalpath outtex md5 backcolor
end
let _ =
Texutil.set_encoding (try Sys.argv.(4) with _ -> "UTF-8");
- try render Sys.argv.(1) Sys.argv.(2) (Parser.tex_expr lexer_token_safe (Lexing.from_string Sys.argv.(3)))
+ try render Sys.argv.(1) Sys.argv.(2) (Parser.tex_expr lexer_token_safe (Lexing.from_string Sys.argv.(3))) (try Sys.argv.(5) with _ -> "rgb 1.0 1.0 1.0")
with Parsing.Parse_error -> print_string "S"
| LexerException _ -> print_string "E"
| Texutil.Illegal_tex_function s -> print_string ("F" ^ s)