[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 01 Oct 2003 21:13:50 -0000


albertel		Wed Oct  1 17:13:50 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm londefdef.pm 
  Log:
  - BUG#2254, <m> should not be run::evaluate afterwards
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.281 loncom/xml/lonxml.pm:1.282
--- loncom/xml/lonxml.pm:1.281	Sat Sep 27 00:08:56 2003
+++ loncom/xml/lonxml.pm	Wed Oct  1 17:13:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.281 2003/09/27 04:08:56 albertel Exp $
+# $Id: lonxml.pm,v 1.282 2003/10/01 21:13:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,6 +163,9 @@
 #array of ssi calls that need to occur after we are done parsing
 @Apache::lonxml::ssi_info=();
 
+#should we do the postag variable interpolation
+$Apache::lonxml::post_evaluate=1;
+
 sub xmlbegin {
   my $output='';
   if ($ENV{'browser.mathml'}) {
@@ -477,7 +480,7 @@
 	&Apache::lonxml::error("Unknown token event :$token->[0]:$token->[1]:");
       }
       #evaluate variable refs in result
-      if ($result ne "") {
+      if ($Apache::lonxml::post_evaluate &&$result ne "") {
 	  my $extras;
 	  if (!$Apache::lonxml::usestyle) {
 	      $extras=$Apache::lonxml::style_values;
@@ -488,6 +491,8 @@
 	  $result= &Apache::run::evaluate($result,$safeeval,$extras);
 	}
       }
+      $Apache::lonxml::post_evaluate=1;
+
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
 	  #Style file definitions should be correct
 	  if ($target eq 'tex' && ($Apache::lonxml::usestyle)) {
@@ -608,6 +613,7 @@
   @Apache::lonxml::pwd=();
   @Apache::lonxml::extlinks=();
   @Apache::lonxml::ssi_info=();
+  $Apache::lonxml::post_evaluate=1;
   if ($target eq 'meta') {
     $Apache::lonxml::redirection = 0;
     $Apache::lonxml::metamode = 1;
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.177 loncom/xml/londefdef.pm:1.178
--- loncom/xml/londefdef.pm:1.177	Wed Oct  1 16:45:05 2003
+++ loncom/xml/londefdef.pm	Wed Oct  1 17:13:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.177 2003/10/01 20:45:05 albertel Exp $
+# $Id: londefdef.pm,v 1.178 2003/10/01 21:13:50 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -92,9 +92,15 @@
 	    $Apache::lontexconvert::errorstring='';
 	}
 	#&Apache::lonxml::debug("M is ends with:$currentstring:");
+	$Apache::lonxml::post_evaluate=0;
     } elsif ($target eq 'tex') {
 	$currentstring = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
+	my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
+	if ($eval eq 'on') {
+	    $currentstring=&Apache::run::evaluate($currentstring,$safeeval,$$parstack[-1]);
+	}
 	if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';}
+	$Apache::lonxml::post_evaluate=0;
     } else {
 	my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
     }