--- loncom/xml/lontexconvert.pm 2005/02/27 17:28:56 1.61
+++ loncom/xml/lontexconvert.pm 2006/09/06 19:43:22 1.77
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# TeX Conversion Module
#
-# $Id: lontexconvert.pm,v 1.61 2005/02/27 17:28:56 albertel Exp $
+# $Id: lontexconvert.pm,v 1.77 2006/09/06 19:43:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,44 +42,39 @@ package Apache::lontexconvert;
use strict;
use tth();
use vars qw($errorstring);
-use Apache();
-use Apache::lonmsg();
-use Apache::lonxml();
-use Apache::lonmenu();
+#use Apache::lonxml();
use Apache::lonlocal;
+use Apache::lonnet;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
# ====================================================================== Header
sub init_tth {
- my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'};
- if ($ENV{'browser.mathml'}) {
+ my $options=$env{'course.'.$env{'request.course.id'}.'.tthoptions'};
+ if ($options =~ /\S/) {
+ $options = ' '.$options;
+ } else {
+ undef($options);
+ }
+ if ($env{'browser.mathml'}) {
&tth::ttminit();
- if ($ENV{'browser.unicode'}) {
- &tth::ttmoptions('-L -u1 '.$options);
+ if ($env{'browser.unicode'}) {
+ &tth::ttmoptions('-L -u1'.$options);
} else {
- &tth::ttmoptions('-L -u0 '.$options);
+ &tth::ttmoptions('-L -u0'.$options);
}
} else {
&tth::tthinit();
- if ($ENV{'browser.unicode'}) {
- &tth::tthoptions('-L -u1 '.$options);
+ if ($env{'browser.unicode'}) {
+ &tth::tthoptions('-L -u1'.$options);
} else {
- &tth::tthoptions('-L -u0 '.$options);
+ &tth::tthoptions('-L -u0'.$options);
}
}
}
-sub header {
- $errorstring='';
- my $time=time;
- &init_tth();
- return &Apache::lonxml::xmlbegin().
- "\n
\n".
- &Apache::lonxml::fontsettings().
- &Apache::lonmenu::registerurl(undef,'tex').
- "\n\n";
-}
-
# ================================================================== Conversion
$Apache::lontexconvert::messedup=0;
@@ -98,8 +93,8 @@ sub convert_real {
$Apache::lontexconvert::messedup=1;
die &mt("TeX unconverted due to errors");
};
- alarm($Apache::lonnet::perlvar{'lonScriptTimeout'});
- if ($ENV{'browser.mathml'}) {
+ &Apache::lonxml::start_alarm();
+ if ($env{'browser.mathml'}) {
$xmlstring=&tth::ttm($$texstring);
$xmlstring=~s/\