File:  [LON-CAPA] / loncom / xml / lontex.pm
Revision 1.2: download - view: text, annotated - select for diffs
Mon May 28 20:16:50 2001 UTC (22 years, 11 months ago) by www
Branches: MAIN
CVS tags: stable_2001_fall, HEAD
Registers and unregisters with Remote

    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());
   44:   $r->print(
   45:  '<body bgcolor="#FFFFFF" onLoad="LONCAPAreg();" onUnload="LONCAPAstale();">');
   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>