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

www lon-capa-cvs@mail.lon-capa.org
Mon, 29 Jul 2002 22:06:38 -0000


www		Mon Jul 29 18:06:38 2002 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm lonxml.pm 
  Log:
  Moved tex convertion of messages into lontexconvert. Having problems with
  getting tth into LaTeX mode.
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.5 loncom/xml/lontexconvert.pm:1.6
--- loncom/xml/lontexconvert.pm:1.5	Wed Mar  6 15:27:00 2002
+++ loncom/xml/lontexconvert.pm	Mon Jul 29 18:06:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.5 2002/03/06 20:27:00 matthew Exp $
+# $Id: lontexconvert.pm,v 1.6 2002/07/29 22:06:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,6 +95,20 @@
 # -------------------------------------------------------------------- End Body
   $xmlstring.=&Apache::lonxml::xmlend();
   return $xmlstring;
+}
+
+# ------------------------------------------------------------ Message display
+
+sub msgtexconverted {
+    my $message=shift;
+    if ($ENV{'browser.mathml'}) {
+      &tth::ttminit();
+    } else {
+      &tth::tthinit();
+    }
+    $message=~s/(\$[^\$]+\$)/&converted(\$1)/ge;
+    $message=~s/(\\\[[^\]]+\])/&converted(\$1)/ge;
+    return $message;
 }
 
 1;
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.185 loncom/xml/lonxml.pm:1.186
--- loncom/xml/lonxml.pm:1.185	Wed Jul 24 17:18:36 2002
+++ loncom/xml/lonxml.pm	Mon Jul 29 18:06:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.185 2002/07/24 21:18:36 www Exp $
+# $Id: lonxml.pm,v 1.186 2002/07/29 22:06:38 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -176,9 +176,7 @@
 		unless (($hidden) && (!$seeid)) {
                  my $message=$contrib{$idx.':message'};
                  $message=~s/\n/\<br \/\>/g;
-                 if (($message=~/\$.+\$/) || ($message=~/\\\[.+\\\]/)) {
-		     $message=&Apache::lontexconvert::converted(\$message);
-                 }
+		 $message=&Apache::lontexconvert::msgtexconverted($message);
                  if ($message) {
                   if ($hidden) {
 		      $message='<font color="#888888">'.$message.'</font>';