--- loncom/xml/lontexconvert.pm 2004/03/04 15:40:22 1.31 +++ loncom/xml/lontexconvert.pm 2004/03/09 15:53:18 1.35 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Conversion Module # -# $Id: lontexconvert.pm,v 1.31 2004/03/04 15:40:22 albertel Exp $ +# $Id: lontexconvert.pm,v 1.35 2004/03/09 15:53:18 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,12 +42,13 @@ package Apache::lontexconvert; use strict; -use tth; +use tth(); use vars qw($errorstring); use Apache(); -use Apache::lonmsg; -use Apache::lonxml; -use Apache::lonmenu; +use Apache::lonmsg(); +use Apache::lonxml(); +use Apache::lonmenu(); +use Apache::lonlocal; # ====================================================================== Header @@ -86,13 +87,18 @@ sub header { $Apache::lontexconvert::messedup=0; sub converted { my $texstring=shift; - my $xmlstring='[UNDISPLAYABLE]'; + my $xmlstring='['.&mt('UNDISPLAYABLE').']'; if ($Apache::lontexconvert::messedup) { - return '[TeX Unconverted Due To Previous Errors]'; + return '['.&mt('TeX unconverted due to previous errors').']'; } eval(<<'ENDCONV'); { local $SIG{SEGV}=sub { $Apache::lontexconvert::messedup=1; die; }; + local $SIG{ALRM}=sub { + $xmlstring='['.&mt("TeX unconverted due to errors").']'; + $Apache::lontexconvert::messedup=1; + die &mt("TeX unconverted due to errors"); }; + alarm($Apache::lonnet::perlvar{'lonScriptTimeout'}); if ($ENV{'browser.mathml'}) { $xmlstring=&tth::ttm($$texstring); $xmlstring=~s/\/\/g; @@ -106,8 +112,13 @@ sub converted { } $xmlstring=~s/^\s*//; $xmlstring=~s/\s*$//; + alarm(0); } ENDCONV + if ($@) { + $errorstring.=&mt("Evaluation Error: ").$@; + $Apache::lontexconvert::messedup=1; + } if ($Apache::lontexconvert::messedup || &tth::tthmessedup()) { &Apache::lonnet::logthis("Trying to kill myself"); $Apache::lontexconvert::messedup=1;