Annotation of loncom/xml/lontexconvert.pm, revision 1.3
1.1 harris41 1: # The LearningOnline Network with CAPA
2: # TeX Conversion Module
3: #
4: # 05/29/00,05/30,10/11,10/20 Gerd Kortemeyer
5: # 05/03/2001 Scott Harrison
1.3 ! www 6: # 5/4 Gerd Kortemeyer
1.1 harris41 7:
8: package Apache::lontexconvert;
9:
10: use strict;
11: use tth;
12: use vars qw($errorstring);
13: use Apache::lonmsg;
1.3 ! www 14: use Apache::lonxml;
1.1 harris41 15:
16: # ====================================================================== Header
17:
18: sub header {
19: $errorstring='';
20: my $time=time;
21: if ($ENV{'browser.mathml'}) {
22: &tth::ttminit();
23: } else {
24: &tth::tthinit();
25: }
1.3 ! www 26: return &Apache::lonxml::xmlbegin().
! 27: &Apache::lonxml::fontsettings().
! 28: "\n<head>\n".
! 29: &Apache::lonxml::registerurl().
! 30: "\n</head>\n";
1.1 harris41 31: }
32:
33: # ================================================================== Conversion
34:
35: sub converted {
36: my $texstring=shift;
37: my $xmlstring;
38: if ($ENV{'browser.mathml'}) {
39: $xmlstring=&tth::ttm($$texstring);
40: $xmlstring=~s/\<math\>/\<math xmlns=\"\&mathns\;\"\>/g;
41: $xmlstring=~s/\<br\>/\<br\/\>/g;
42: $xmlstring=~s/\<p\>/\<p\>\<\/p\>/g;
43: $errorstring.=&tth::ttmerror();
44: } else {
45: $xmlstring=&tth::tth($$texstring);
46: $errorstring.=&tth::ttherror();
47: }
48: return $xmlstring;
49: }
50:
51: # ====================================================================== Footer
52:
53: sub footer {
54: my $xmlstring='';
55: if ($ENV{'request.state'} eq 'construct') {
56: $xmlstring.='<address>'.$errorstring.'</address>';
57: } else {
58: &Apache::lonmsg::author_res_msg($ENV{'request.filename'},$errorstring);
59: }
60: # -------------------------------------------------------------------- End Body
1.3 ! www 61: $xmlstring.=&Apache::lonxml::xmlend();
1.1 harris41 62: return $xmlstring;
63: }
64:
65: 1;
66: __END__
67:
68:
69:
70:
71:
72:
73:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>