--- loncom/xml/lontex.pm 2005/04/07 06:56:27 1.7 +++ loncom/xml/lontex.pm 2023/12/22 13:38:01 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Content Handler # -# $Id: lontex.pm,v 1.7 2005/04/07 06:56:27 albertel Exp $ +# $Id: lontex.pm,v 1.14 2023/12/22 13:38:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,8 +50,23 @@ use tth; # ================================================================ Main Handler +sub footer { + my ($errorstring) = @_; + my $xmlstring=''; + if ($env{'request.state'} eq 'construct') { + $xmlstring.='
'. + $Apache::lontexconvert::errorstring.'
'; + } else { + &Apache::lonmsg::author_res_msg($env{'request.filename'}, + $Apache::lonxml::errorstring); + } +# -------------------------------------------------------------------- End Body + $xmlstring.=&Apache::loncommon::end_page({'discussion' => 1}); + return $xmlstring; +} + sub handler { - my $r=shift; + my ($r)= @_; my @texcontents; my $texstring; @@ -77,18 +92,27 @@ sub handler { # --------------------------------------------------------------- Render Output - $r->print(&Apache::lontexconvert::header()); - $r->print( - ''. - &Apache::lonmenu::menubuttons(undef,'web',1) - ); - $r->print(&Apache::lontexconvert::converted(\$texstring)); - $r->print(''); - $r->print(&Apache::lontexconvert::footer()); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['texengine','inhibitmenu']); + + + $r->print(&Apache::loncommon::start_page(undef,undef, + {'bgcolor' => '#FFFFFF', + 'force_register' => 1, + 'only_body' => + ($env{'form.inhibitmenu'} + eq 'yes'), })); + + my $displaymode; + if (&Apache::lonnet::EXT('resource.0.texdisplay') =~ /^(tth|mathjax)$/i) { + $displaymode = $1; + } + if ($env{'form.texengine'} =~ /^(tth|mathjax)$/i) { + $displaymode = $1; + } + $r->print(&Apache::lontexconvert::converted(\$texstring, + $displaymode)); + $r->print(&footer()); return OK; } @@ -96,6 +120,32 @@ sub handler { 1; __END__ +=pod + +=head1 NAME + +Apache::lontex.pm + +=head1 SYNOPSIS + +Handler for tex files (somewhere in modules) + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=head1 SUBROUTINES + +=over + +=item footer() + +Main Handler + +=back + +=cut +