Annotation of loncom/xml/lontex.pm, revision 1.2

1.1       harris41    1: # The LearningOnline Network with CAPA
                      2: # TeX Content Handler
                      3: #
                      4: # 05/29/00,05/30,10/11 Gerd Kortemeyer
                      5: 
                      6: package Apache::lontex;
                      7: 
                      8: use strict;
                      9: use Apache::File;
                     10: use Apache::lontexconvert;
                     11: use Apache::Constants qw(:common);
                     12: use tth;
                     13: 
                     14: # ================================================================ Main Handler
                     15: 
                     16: sub handler {
                     17:   my $r=shift;
                     18:   my @texcontents;
                     19:   my $texstring;
                     20: 
                     21: # ----------------------------------------------------------- Set document type
                     22: 
                     23:   if ($ENV{'browser.mathml'}) {
                     24:     $r->content_type('text/xml');
                     25:   } else {
                     26:     $r->content_type('text/html');
                     27:   }
                     28:   $r->send_http_header;
                     29: 
                     30:   return OK if $r->header_only;
                     31: 
                     32: # ------------------------------------------------------------------- Read file
                     33: 
                     34:   {
                     35:     my $fh=Apache::File->new($r->filename);
                     36:     @texcontents=<$fh>;
                     37:   }
                     38: 
                     39:   $texstring=join("\n",@texcontents);
                     40: 
                     41: # --------------------------------------------------------------- Render Output
                     42:   
                     43:   $r->print(&Apache::lontexconvert::header());
1.2     ! www        44:   $r->print(
        !            45:  '<body bgcolor="#FFFFFF" onLoad="LONCAPAreg();" onUnload="LONCAPAstale();">');
1.1       harris41   46:   $r->print(&Apache::lontexconvert::converted(\$texstring));
                     47:   $r->print('</body>');
                     48:   $r->print(&Apache::lontexconvert::footer());
                     49: 
                     50:   return OK;
                     51: }
                     52: 
                     53: 1;
                     54: __END__
                     55: 
                     56: 
                     57: 
                     58: 
                     59: 
                     60: 
                     61: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>