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

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());
        !            44:   $r->print('<body bgcolor="#FFFFFF">');
        !            45:   $r->print(&Apache::lontexconvert::converted(\$texstring));
        !            46:   $r->print('</body>');
        !            47:   $r->print(&Apache::lontexconvert::footer());
        !            48: 
        !            49:   return OK;
        !            50: }
        !            51: 
        !            52: 1;
        !            53: __END__
        !            54: 
        !            55: 
        !            56: 
        !            57: 
        !            58: 
        !            59: 
        !            60: 

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