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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 28 Aug 2002 17:07:54 -0000


sakharuk		Wed Aug 28 13:07:54 2002 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  ;
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.188 loncom/xml/lonxml.pm:1.189
--- loncom/xml/lonxml.pm:1.188	Fri Aug 23 15:10:32 2002
+++ loncom/xml/lonxml.pm	Wed Aug 28 13:07:54 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.188 2002/08/23 19:10:32 sakharuk Exp $
+# $Id: lonxml.pm,v 1.189 2002/08/28 17:07:54 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -547,10 +547,11 @@
     } else {
 	if ($current_token=~m/\^/) {$current_token=~s/\^/}\\verb|\^|{/g;}
     }
-    if ($current_token=~m/>/) {$current_token=~s/>/\$>\$/g;}
-    if ($current_token=~m/</) {$current_token=~s/</\$<\$/g;}
-    if ($current_token=~m/\d%/) {$current_token =~ s/%/\\%/g;}
-    if ($current_token=~m/\s%/) {$current_token =~ s/%/\\%/g;}
+    if ($current_token=~m/>/) {$current_token=~s/>/\$>\$/g;} #more
+    if ($current_token=~m/</) {$current_token=~s/</\$<\$/g;} #less
+    if ($current_token=~m/\d%/) {$current_token =~ s/%/\\%/g;} #percent after digit
+    if ($current_token=~m/\s%/) {$current_token =~ s/%/\\%/g;} #persent after space
+
 
 #    $current_token = ' start='.$current_token.'=finish ';
     return $current_token;
@@ -566,7 +567,12 @@
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
 	if ($metamode<1) {
 	    if ($target eq 'tex') {
-		$result.=&latex_special_sumbols($token->[1],$stack,$parstack);
+		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];
 	    }
@@ -758,13 +764,13 @@
     }
     if (!$deleted) {
       if ($space) {
-	#&Apache::lonxml::debug("Calling sub $sub in $space $metamode");
+	&Apache::lonxml::debug("Calling sub $sub in $space $metamode");
 	$sub1="$space\:\:$sub";
 	($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
 					     $parstack,$parser,$safeeval,
 					     $style);
       } else {
-	#&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
+	&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
 	if ($metamode <1) {
 	  if (defined($token->[4]) && ($metamode < 1)) {
 	    $currentstring = $token->[4];