diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
commit | 9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch) | |
tree | 46d1a0dee7febef5c2d57a9f7b972be16a163b3d /math/texvc.ml | |
parent | 78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff) |
update to MediaWiki 1.17.0
Diffstat (limited to 'math/texvc.ml')
-rw-r--r-- | math/texvc.ml | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/math/texvc.ml b/math/texvc.ml index 38a7e93b..33a14b7b 100644 --- a/math/texvc.ml +++ b/math/texvc.ml @@ -1,8 +1,12 @@ +(* vim: set sw=8 ts=8 et: *) exception LexerException of string + +(* *) let lexer_token_safe lexbuf = try Lexer.token lexbuf with Failure s -> raise (LexerException s) +(* *) let render tmppath finalpath tree backcolor = let outtex = Util.mapjoin Texutil.render_tex tree in let md5 = Digest.to_hex (Digest.string outtex) in @@ -21,9 +25,29 @@ let render tmppath finalpath tree backcolor = ); Render.render tmppath finalpath outtex md5 backcolor end + +(* TODO: document + * Arguments: + * 1st : + * 2nd : + * 3rd : + * 4th : encoding (Default: UTF-8) + * 5th : color (Default: rgb 1.0 1.0 1.0) + * + * Output one character: + * S : Parsing error + * E : Lexer exception raised + * F : TeX function not recognized + * - : Generic/Default failure code. Might be an invalid argument, + * output file already exist, a problem with an external + * command ... + * *) 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 Sys.argv.(5) with _ -> "rgb 1.0 1.0 1.0") + 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) |