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

www lon-capa-cvs@mail.lon-capa.org
Mon, 28 Oct 2002 20:40:25 -0000


www		Mon Oct 28 15:40:25 2002 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  Catches frequent tth-segfaults due to bad LaTeX.
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.11 loncom/xml/lontexconvert.pm:1.12
--- loncom/xml/lontexconvert.pm:1.11	Fri Oct 25 11:08:09 2002
+++ loncom/xml/lontexconvert.pm	Mon Oct 28 15:40:25 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.11 2002/10/25 15:08:09 www Exp $
+# $Id: lontexconvert.pm,v 1.12 2002/10/28 20:40:25 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,18 +68,23 @@
 # ================================================================== Conversion
 
 sub converted {
-    my $texstring=shift;
-    my $xmlstring;
+  my $texstring=shift;
+  my $xmlstring='[UNDISPLAYABLE]';
+  eval(<<'ENDCONV');
+  { 
+    local $SIG{SEGV}=sub { die; };
     if ($ENV{'browser.mathml'}) {
       $xmlstring=&tth::ttm($$texstring);
       $xmlstring=~s/\<math\>/\<math xmlns=\"\&mathns\;\"\>/g;
       $xmlstring=~s/\<br\>/\<br\/\>/g;
       $xmlstring=~s/\<p\>/\<p\>\<\/p\>/g;
       $errorstring.=&tth::ttmerror();
-  } else {
+    } else {
       $xmlstring=&tth::tth($$texstring);
       $errorstring.=&tth::ttherror();
+    }
   }
+ENDCONV
   return $xmlstring;
 }