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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 04 Sep 2002 03:57:18 -0000


albertel		Tue Sep  3 23:57:18 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - this works better, it will encode text sections that have variables with latex symbols in them.
  
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.189 loncom/xml/lonxml.pm:1.190
--- loncom/xml/lonxml.pm:1.189	Wed Aug 28 13:07:54 2002
+++ loncom/xml/lonxml.pm	Tue Sep  3 23:57:18 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.189 2002/08/28 17:07:54 sakharuk Exp $
+# $Id: lonxml.pm,v 1.190 2002/09/04 03:57:18 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -566,16 +566,12 @@
     while ($token = $$pars['-1']->get_token) {
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
 	if ($metamode<1) {
-	    if ($target eq 'tex') {
-		my $text=$token->[1];
-		if ($token->[0] eq 'C') {
-		    $text = '%'.$text;
-		    $text =~ s/[\n\r]//g;
-		}
-		$result.=&latex_special_sumbols($text,$stack,$parstack);
-	    } else {
-		$result.=$token->[1];
+	    my $text=$token->[1];
+	    if ($token->[0] eq 'C') {
+		$text = '%'.$text;
+		$text =~ s/[\n\r]//g;
 	    }
+	    $result.=$text;
 	}
       } elsif ($token->[0] eq 'PI') {
 	if ($metamode<1) {
@@ -638,6 +634,12 @@
 	  $result= &Apache::run::evaluate($result,$safeeval,'');
 	}
       }
+      if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
+	if ($target eq 'tex') {
+	    $result=&latex_special_sumbols($result,$stack,$parstack);
+	}
+      }
+
       # Encode any high ASCII characters
       if (!$Apache::lonxml::prevent_entity_encode) {
 	$result=&HTML::Entities::encode($result,"\200-\377");
@@ -963,6 +965,7 @@
 }
 
 sub get_all_text_unbalanced {
+#there is a copy of this in lonpublisher.pm
  my($tag,$pars)= @_;
  my $token;
  my $result='';