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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 23 Oct 2006 18:49:47 -0000


albertel		Mon Oct 23 14:49:47 2006 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  - death to $_
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.78 loncom/xml/lontexconvert.pm:1.79
--- loncom/xml/lontexconvert.pm:1.78	Thu Sep  7 17:51:16 2006
+++ loncom/xml/lontexconvert.pm	Mon Oct 23 14:49:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.78 2006/09/07 21:51:16 albertel Exp $
+# $Id: lontexconvert.pm,v 1.79 2006/10/23 18:49:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -267,8 +267,8 @@
 		 '\:\-(X|\#)' => 'lipsrsealed',
 		 '\:\-S' => 'huh');
     my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
-    foreach (keys %smileys) {
-	$expression=~s/$_/\<img src="$iconpath\/$smileys{$_}.gif" \/\>/gs; 
+    foreach my $smiley (keys(%smileys)) {
+	$expression=~s/$smiley/\<img src="$iconpath\/$smileys{$smiley}.gif" \/\>/gs; 
     }
     return $expression;
 }
@@ -279,27 +279,34 @@
     &init_tth();
     my $outmessage='';
     my $tex=0;
-    foreach (split(/(?:\&lt\;|\<)\/*m\s*(?:\&gt\;|\>)/i,$message)) {
+    foreach my $fragment (split(/(?:\&lt\;|\<)\/*m\s*(?:\&gt\;|\>)/i,$message)) {
 	if ($tex) {
 	    if ($email) {
-		$outmessage.='</pre><tt>'.&to_convert($_).'</tt><pre>'; $tex=0;
+		$outmessage.='</pre><tt>'.&to_convert($fragment).'</tt><pre>';
+		$tex=0;
 	    } else {
-		$outmessage.=&to_convert($_); $tex=0;
+		$outmessage.=&to_convert($fragment);
+		$tex=0;
 	    }
 	} else {
-            $outmessage.=&smiley($_); $tex=1;
+            $outmessage.=&smiley($fragment);
+	    $tex=1;
 	}
     }
     $message=$outmessage; $outmessage=''; $tex=0;
-    foreach (split(/(?:\&lt\;|\<)\/*algebra\s*(?:\&gt\;|\>)/i,$message)) {
+    foreach my $fragment (split(/(?:\&lt\;|\<)\/*algebra\s*(?:\&gt\;|\>)/i,
+				$message)) {
 	if ($tex) {
 	    if ($email) {
-		$outmessage.='</pre><tt>'.&algebra($_,'web').'</tt><pre>'; $tex=0;
+		$outmessage.='</pre><tt>'.&algebra($fragment,'web').'</tt><pre>';
+		$tex=0;
 	    } else {
-		$outmessage.=&algebra($_,'web'); $tex=0;
+		$outmessage.=&algebra($fragment,'web');
+		$tex=0;
 	    }
 	} else {
-            $outmessage.=$_; $tex=1;
+            $outmessage.=$fragment;
+	    $tex=1;
 	}
     }
     if (wantarray) {