version 1.32, 2004/03/04 15:41:18
|
version 1.35, 2004/03/09 15:53:18
|
Line 42
|
Line 42
|
package Apache::lontexconvert; |
package Apache::lontexconvert; |
|
|
use strict; |
use strict; |
use tth; |
use tth(); |
use vars qw($errorstring); |
use vars qw($errorstring); |
use Apache(); |
use Apache(); |
use Apache::lonmsg; |
use Apache::lonmsg(); |
use Apache::lonxml; |
use Apache::lonxml(); |
use Apache::lonmenu; |
use Apache::lonmenu(); |
|
use Apache::lonlocal; |
|
|
# ====================================================================== Header |
# ====================================================================== Header |
|
|
Line 86 sub header {
|
Line 87 sub header {
|
$Apache::lontexconvert::messedup=0; |
$Apache::lontexconvert::messedup=0; |
sub converted { |
sub converted { |
my $texstring=shift; |
my $texstring=shift; |
my $xmlstring='[UNDISPLAYABLE]'; |
my $xmlstring='['.&mt('UNDISPLAYABLE').']'; |
if ($Apache::lontexconvert::messedup) { |
if ($Apache::lontexconvert::messedup) { |
return '[TeX Unconverted Due To Previous Errors]'; |
return '['.&mt('TeX unconverted due to previous errors').']'; |
} |
} |
eval(<<'ENDCONV'); |
eval(<<'ENDCONV'); |
{ |
{ |
local $SIG{SEGV}=sub { $Apache::lontexconvert::messedup=1; die; }; |
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'}) { |
if ($ENV{'browser.mathml'}) { |
$xmlstring=&tth::ttm($$texstring); |
$xmlstring=&tth::ttm($$texstring); |
$xmlstring=~s/\<math\>/\<math xmlns=\"\&mathns\;\"\>/g; |
$xmlstring=~s/\<math\>/\<math xmlns=\"\&mathns\;\"\>/g; |
Line 106 sub converted {
|
Line 112 sub converted {
|
} |
} |
$xmlstring=~s/^\s*//; |
$xmlstring=~s/^\s*//; |
$xmlstring=~s/\s*$//; |
$xmlstring=~s/\s*$//; |
|
alarm(0); |
} |
} |
ENDCONV |
ENDCONV |
if ($@) { |
if ($@) { |
$errorstring.="Evaluation Error $@"; |
$errorstring.=&mt("Evaluation Error: ").$@; |
$Apache::lontexconvert::messedup=1; |
$Apache::lontexconvert::messedup=1; |
} |
} |
if ($Apache::lontexconvert::messedup || &tth::tthmessedup()) { |
if ($Apache::lontexconvert::messedup || &tth::tthmessedup()) { |