dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f83b918
)
render.ml updated to support newer ImageMagick and relative filepaths
author
Tomasz Wegrzanowski
<taw@users.mediawiki.org>
Mon, 28 Jun 2004 11:09:24 +0000
(11:09 +0000)
committer
Tomasz Wegrzanowski
<taw@users.mediawiki.org>
Mon, 28 Jun 2004 11:09:24 +0000
(11:09 +0000)
math/render.ml
patch
|
blob
|
history
diff --git
a/math/render.ml
b/math/render.ml
index
939374a
..
edd5984
100644
(file)
--- a/
math/render.ml
+++ b/
math/render.ml
@@
-1,17
+1,19
@@
-let cmd_dvips tmpprefix = "dvips -
q -R -E " ^ tmpprefix ^ ".dvi -f
"
+let cmd_dvips tmpprefix = "dvips -
R -E " ^ tmpprefix ^ ".dvi -f >" ^ tmpprefix ^ ".ps
"
let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null"
let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null"
-let cmd_convert
finalpath = "convert -quality 100 -density 120 ps:-
" ^ finalpath ^ " >/dev/null 2>/dev/null"
+let cmd_convert
tmpprefix finalpath = "convert -quality 100 -density 120 " ^ tmpprefix ^ ".ps
" ^ finalpath ^ " >/dev/null 2>/dev/null"
exception ExternalCommandFailure of string
let render tmppath finalpath outtex md5 =
exception ExternalCommandFailure of string
let render tmppath finalpath outtex md5 =
- let tmpprefix = (tmppath^"/"^(string_of_int (Unix.getpid ()))^"_"^md5) in
+ let tmpprefix0 = (string_of_int (Unix.getpid ()))^"_"^md5 in
+ let tmpprefix = (tmppath^"/"^tmpprefix0) in
let unlink_all () =
begin
Sys.remove (tmpprefix ^ ".dvi");
Sys.remove (tmpprefix ^ ".aux");
Sys.remove (tmpprefix ^ ".log");
let unlink_all () =
begin
Sys.remove (tmpprefix ^ ".dvi");
Sys.remove (tmpprefix ^ ".aux");
Sys.remove (tmpprefix ^ ".log");
- Sys.remove (tmpprefix ^ ".tex")
+ Sys.remove (tmpprefix ^ ".tex");
+ Sys.remove (tmpprefix ^ ".ps");
end in
let f = (Util.open_out_unless_exists (tmpprefix ^ ".tex")) in
begin
end in
let f = (Util.open_out_unless_exists (tmpprefix ^ ".tex")) in
begin
@@
-19,9
+21,11
@@
let render tmppath finalpath outtex md5 =
output_string f outtex;
output_string f (Texutil.get_footer ());
close_out f;
output_string f outtex;
output_string f (Texutil.get_footer ());
close_out f;
- if Util.run_in_other_directory tmppath (cmd_latex tmpprefix) != 0
+ if Util.run_in_other_directory tmppath (cmd_latex tmpprefix
0
) != 0
then (unlink_all (); raise (ExternalCommandFailure "latex"))
then (unlink_all (); raise (ExternalCommandFailure "latex"))
- else if (Sys.command ((cmd_dvips tmpprefix) ^ " | " ^ (cmd_convert (finalpath^"/"^md5^".png"))) != 0)
- then (unlink_all (); raise (ExternalCommandFailure ("dvips")))
+ else if (Sys.command (cmd_dvips tmpprefix) != 0)
+ then (unlink_all (); raise (ExternalCommandFailure "dvips"))
+ else if (Sys.command (cmd_convert tmpprefix (finalpath^"/"^md5^".png")) != 0)
+ then (unlink_all (); raise (ExternalCommandFailure "convert"))
else unlink_all ()
end
else unlink_all ()
end