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

# The LearningOnline Network with CAPA
# TeX Content Handler
#
# 05/29/00,05/30,10/11 Gerd Kortemeyer

package Apache::lontex;

use strict;
use Apache::File;
use Apache::lontexconvert;
use Apache::Constants qw(:common);
use tth;

# ================================================================ Main Handler

sub handler {
  my $r=shift;
  my @texcontents;
  my $texstring;

# ----------------------------------------------------------- Set document type

  if ($ENV{'browser.mathml'}) {
    $r->content_type('text/xml');
  } else {
    $r->content_type('text/html');
  }
  $r->send_http_header;

  return OK if $r->header_only;

# ------------------------------------------------------------------- Read file

  {
    my $fh=Apache::File->new($r->filename);
    @texcontents=<$fh>;
  }

  $texstring=join("\n",@texcontents);

# --------------------------------------------------------------- Render Output
  
  $r->print(&Apache::lontexconvert::header());
  $r->print(
 '<body bgcolor="#FFFFFF" onLoad="LONCAPAreg();" onUnload="LONCAPAstale();">');
  $r->print(&Apache::lontexconvert::converted(\$texstring));
  $r->print('</body>');
  $r->print(&Apache::lontexconvert::footer());

  return OK;
}

1;
__END__








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