--- loncom/xml/lonxml.pm 2000/10/09 14:07:02 1.24 +++ loncom/xml/lonxml.pm 2000/10/11 13:07:49 1.25 @@ -27,6 +27,9 @@ use Apache::londefdef; use Apache::scripttag; #================================================== Main subroutine: xmlparse @Apache::lonxml::pwd=(); +$Apache::lonxml::outputstack = ''; +$Apache::lonxml::redirection = 1; + sub xmlparse { my ($target,$content_file_string,$safeinit,%style_for_target) = @_; @@ -40,9 +43,6 @@ sub xmlparse { my $newarg = ''; my $result; - my $indicator = 1; - my $pocketbox = ''; - my $safeeval = new Safe; $safeeval->permit("entereval"); $safeeval->permit(":base_math"); @@ -72,12 +72,12 @@ sub xmlparse { &increasedepth($token); if (exists $style_for_target{$token->[1]}) { - if ($indicator == 1) { + if ($Apache::lonxml::redirection == 1) { $finaloutput .= &recurse($style_for_target{$token->[1]}, $target,$safeeval,\%style_for_target, @parstack); } else { - $pocketbox .= &recurse($style_for_target{$token->[1]}, + $Apache::lonxml::outputstack .= &recurse($style_for_target{$token->[1]}, $target,$safeeval,\%style_for_target, @parstack); } @@ -85,9 +85,6 @@ sub xmlparse { } else { $result = &callsub("start_$token->[1]", $target, $token,\@parstack, \@pars, $safeeval, \%style_for_target); - - if ($result eq "footnote") { &Apache::lonxml::debug($result);} - } } elsif ($token->[0] eq 'E') { #clear out any tags that didn't end @@ -96,12 +93,12 @@ sub xmlparse { if (exists $style_for_target{'/'."$token->[1]"}) { - if ($indicator == 1) { + if ($Apache::lonxml::redirection == 1) { $finaloutput .= &recurse($style_for_target{'/'."$token->[1]"}, $target,$safeeval,\%style_for_target, @parstack); } else { - $pocketbox .= &recurse($style_for_target{'/'."$token->[1]"}, + $Apache::lonxml::outputstack .= &recurse($style_for_target{'/'."$token->[1]"}, $target,$safeeval,\%style_for_target, @parstack); } @@ -111,14 +108,14 @@ sub xmlparse { \@pars,$safeeval, \%style_for_target); } } - if ($result ne "" ) { + if ($result ne "") { if ( $#parstack > -1 ) { - if ($indicator == 1) { + if ($Apache::lonxml::redirection == 1) { $finaloutput .= &Apache::run::evaluate($result,$safeeval, $parstack[$#parstack]); } else { - $pocketbox .= &Apache::run::evaluate($result,$safeeval, + $Apache::lonxml::outputstack .= &Apache::run::evaluate($result,$safeeval, $parstack[$#parstack]); } @@ -126,6 +123,8 @@ sub xmlparse { $finaloutput .= &Apache::run::evaluate($result,$safeeval,''); } $result = ''; + } else { + $finaloutput .= $result; } if ($token->[0] eq 'E') { pop @stack;pop @parstack;&decreasedepth($token);} } @@ -305,14 +304,31 @@ sub handler { my $target='web'; $Apache::lonxml::debug=1; $request->content_type('text/html'); - $request->send_http_header; - $request->print(< - -Just test - - -ENDHEADER +# $request->send_http_header; + if ($ENV{'browser.mathml'}) { + $request->print( '' + .'' + .']>' + .'' + .''."\n"); + } else { + my $headerstring=''; + if ($ENV{'browser.os'} eq 'mac') { + $headerstring.="\n" + .'' + ."\n\n"; + } + $request->print($headerstring.''."\n"); + } +# $request->print(< +# +#Just test +# +# +#ENDHEADER # &Apache::lonhomework::send_header($request); my $file = "/home/httpd/html".$request->uri; my %mystyle; @@ -343,5 +359,18 @@ __END__ + + + + + + + + + + + + +