X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/math/texvc_cgi.ml diff --git a/math/texvc_cgi.ml b/math/texvc_cgi.ml deleted file mode 100644 index 2e6079fe..00000000 --- a/math/texvc_cgi.ml +++ /dev/null @@ -1,62 +0,0 @@ -open Netcgi;; -open Netcgi_types;; -open Netcgi_env;; -open Netchannels;; - -let cgi = new Netcgi.std_activation () -let out = cgi # output # output_string -let math = cgi # argument_value ~default:"" "math" -let tmppath = "/home/taw/public_html/wiki/tmp/" -let finalpath = "/home/taw/public_html/wiki/math/" -let finalurl = "http://wroclaw.taw.pl.eu.org/~taw/wiki/math/" -;; - -let h_header = "\n"^ - "texvc"^ - "
"^ - "
" -let h_footer = "\n" - -let render tmppath finalpath tree = - let outtex = Texutil.mapjoin Texutil.print tree in - let md5 = Digest.to_hex (Digest.string outtex) in - begin - out "

TeX

"; - out outtex; (* <, & and > should be protected *) - (try out ("

HTML

" ^ (Texutil.html_render tree)) - with _ -> out "

HTML could not be rendered

"); - try Render.render tmppath finalpath outtex md5; - out ("

Image:

") - with Util.FileAlreadyExists -> out ("

Image:

") - | Failure s -> out ("

Other failure: " ^ s ^ "

") - | Render.ExternalCommandFailure "latex" -> out "

latex failed

" - | Render.ExternalCommandFailure "dvips" -> out "

dvips failed

" - | _ -> out "

Other failure

" - end -;; - -cgi#set_header ();; - -out h_header;; -out math;; -out h_middle;; - -exception LexerException of string -let lexer_token_safe lexbuf = - try Lexer.token lexbuf - with Failure s -> raise (LexerException s) -;; -if math = "" -then () -else try - render tmppath finalpath (Parser.tex_expr lexer_token_safe (Lexing.from_string math)) - with Parsing.Parse_error -> out "

Parse error

" - | LexerException s -> out "

Lexing failure

" - | Texutil.Illegal_tex_function s -> out ("

Illegal TeX function: " ^ s ^ "

") - | Failure s -> out ("

Other failure: " ^ s ^ "

") - | _ -> out "

Other failure

" -;; - -out h_footer