File:  [LON-CAPA] / loncom / xml / lontex.pm
Revision 1.1: download - view: text, annotated - select for diffs
Thu May 3 21:28:53 2001 UTC (23 years ago) by harris41
Branches: MAIN
CVS tags: HEAD
these files are moved from the CVS:modules directory

# 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">');
  $r->print(&Apache::lontexconvert::converted(\$texstring));
  $r->print('</body>');
  $r->print(&Apache::lontexconvert::footer());

  return OK;
}

1;
__END__








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