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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 27 Jan 2006 23:56:57 -0000


albertel		Fri Jan 27 18:56:57 2006 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  - <m> now shows it errors like <script> does
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.316 loncom/xml/londefdef.pm:1.317
--- loncom/xml/londefdef.pm:1.316	Fri Jan 27 17:30:23 2006
+++ loncom/xml/londefdef.pm	Fri Jan 27 18:56:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.316 2006/01/27 22:30:23 foxr Exp $
+# $Id: londefdef.pm,v 1.317 2006/01/27 23:56:55 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -105,11 +105,21 @@
 	    $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);
 	    #&Apache::lonxml::debug("M is evaulated to:$inside:");
 	}
+	my $tex = $inside;
 	my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval);
 	$currentstring = &Apache::lontexconvert::converted(\$inside,$display);
 	if ($Apache::lontexconvert::errorstring) {
-	    &Apache::lonxml::warning("tth error: ".
-				     $Apache::lontexconvert::errorstring);
+	    my $errormsg='<pre>'.&HTML::Entities::encode($Apache::lontexconvert::errorstring,'<>&"').'</pre> occured while attempting to convert this TeX: <pre>';
+	    $tex = &HTML::Entities::encode($tex,'<>&"');
+	    my ($linenumber) =
+		($Apache::lontexconvert::errorstring =~ /Line (\d+)/);
+	    if (defined($linenumber)) {
+		my @tex=split("\n",$tex);
+		$tex[$linenumber]='<b><font color="red">'.
+		    $tex[$linenumber].'</font></b>';
+		$tex=join("\n",@tex);
+	    }
+	    &Apache::lonxml::warning($errormsg.$tex.'</pre>');
 	    $Apache::lontexconvert::errorstring='';
 	}
 	#&Apache::lonxml::debug("M is ends with:$currentstring:");