--- loncom/xml/scripttag.pm 2004/02/11 15:10:05 1.108 +++ loncom/xml/scripttag.pm 2004/10/08 13:43:31 1.119 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Script Vars
"; + $result.= "');newWindow.document.close();}Script Vars
"; } } elsif ($target eq "edit" ) { #&Apache::run::run($bodytext,$safeeval); @@ -136,11 +136,11 @@ sub start_script { my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); } } else { - if ($target ne "meta") { - $result = $token->[4]; my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser); - $result.=$bodytext; - } + if ($target ne "meta" && $target ne 'tex') { + $result = $token->[4]; + $result.=$bodytext; + } } return $result; } @@ -151,7 +151,7 @@ sub end_script { my $type = &Apache::lonxml::get_param('type',$parstack,$safeeval); my $result=''; #other script blocks need to survive - if ($type ne "loncapa/perl") { + if ($type ne "loncapa/perl" && $target ne 'tex') { return $token->[2]; } elsif ($target eq 'edit' ) { return &Apache::edit::end_table(); @@ -163,7 +163,7 @@ sub end_script { sub start_display { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; - + @Apache::scripttag::parser_env = @_; my $result; if ( $target eq "modified" ) { @@ -178,11 +178,14 @@ sub start_display { $result=&Apache::run::run($bodytext,$safeeval); if ($target eq 'grade' || $target eq 'answer' || $target eq 'analyze') { - $result=''; # grade should produce no output + # grade/answer/analyxe should produce no output but if we + # are redirecting, the redirecter should know what to do + # with the output + if (!$Apache::lonxml::redirection) { $result=''; } } $Apache::lonxml::post_evaluate=0; } elsif ($target eq "edit" ) { - my $bodytext=&Apache::lonxml::get_all_text_unblanced("/display",$parser); + my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/display",$parser); #$result = # "
<$token->[1]> output:
$bodytext
Source:
"; #$result.=&Apache::edit::editfield($token->[1],$bodytext,'',40,1); @@ -481,7 +484,15 @@ sub end_comment { sub xmlparse { my ($string) = @_; -# &Apache::lonxml::debug("Got $string"); + &Apache::lonxml::debug("xmlparse recursion starting with $string"); + # Apache::run::evaluate does an 'eval' on the name of the subroutine + # if it detects something that looks like a subroutine, this ends up calling + # things without any arguments and since perl is nice enough to pass + # along the default arguments when you don't explicitly say no arguments + # if you call &xmlparse, it gets &xmlparse passed as it argument. + # Same thing soccurs with &chemparse. + if ($string eq '&xmlparse') { return '&xmlparse'; } + if ($string eq '&chemparse') { return '&chemparse'; } my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)= @Apache::scripttag::parser_env; my @parser; @@ -489,6 +500,7 @@ sub xmlparse { my $result=&Apache::lonxml::inner_xmlparse($target,$tagstack, $parstack,\@parser, $safeeval,$style); + &Apache::lonxml::debug("xmlparse recursion ending with $result"); return $result; }