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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 04 Mar 2004 15:40:23 -0000


albertel		Thu Mar  4 10:40:23 2004 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  - retabination
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.30 loncom/xml/lontexconvert.pm:1.31
--- loncom/xml/lontexconvert.pm:1.30	Wed Jan 28 15:48:35 2004
+++ loncom/xml/lontexconvert.pm	Thu Mar  4 10:40:22 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.30 2004/01/28 20:48:35 albertel Exp $
+# $Id: lontexconvert.pm,v 1.31 2004/03/04 15:40:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,50 +71,50 @@
 }
 
 sub header {
-  $errorstring='';
-  my $time=time;
-  &init_tth();
-  return &Apache::lonxml::xmlbegin().
-         &Apache::lonxml::fontsettings().
-         "\n<head>\n".
-         &Apache::lonmenu::registerurl(undef,'tex').
-	 "\n</head>\n";
+    $errorstring='';
+    my $time=time;
+    &init_tth();
+    return &Apache::lonxml::xmlbegin().
+	&Apache::lonxml::fontsettings().
+	"\n<head>\n".
+	&Apache::lonmenu::registerurl(undef,'tex').
+	"\n</head>\n";
 }
 
 # ================================================================== Conversion
 
 $Apache::lontexconvert::messedup=0;
 sub converted {
-  my $texstring=shift;
-  my $xmlstring='[UNDISPLAYABLE]';
-  if ($Apache::lontexconvert::messedup) {
-      return '[TeX Unconverted Due To Previous Errors]';
-  }
-  eval(<<'ENDCONV');
-  {
-    local $SIG{SEGV}=sub { $Apache::lontexconvert::messedup=1; 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 {
-      $xmlstring=&tth::tth($$texstring);
-      $errorstring.=&tth::ttherror();
-      $xmlstring=~s-</font(\s*)>-</font>-g;
+    my $texstring=shift;
+    my $xmlstring='[UNDISPLAYABLE]';
+    if ($Apache::lontexconvert::messedup) {
+	return '[TeX Unconverted Due To Previous Errors]';
+    }
+    eval(<<'ENDCONV');
+    {
+	local $SIG{SEGV}=sub { $Apache::lontexconvert::messedup=1; 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 {
+	    $xmlstring=&tth::tth($$texstring);
+	    $errorstring.=&tth::ttherror();
+	    $xmlstring=~s-</font(\s*)>-</font>-g;
+	}
+	$xmlstring=~s/^\s*//;
+	$xmlstring=~s/\s*$//;
     }
-    $xmlstring=~s/^\s*//;
-    $xmlstring=~s/\s*$//;
-  }
 ENDCONV
-  if ($Apache::lontexconvert::messedup || &tth::tthmessedup()) {
-      &Apache::lonnet::logthis("Trying to kill myself");
-      $Apache::lontexconvert::messedup=1;
-      my $request=Apache->request();
-      $request->child_terminate();
-  }
-  return $xmlstring;
+    if ($Apache::lontexconvert::messedup || &tth::tthmessedup()) {
+	&Apache::lonnet::logthis("Trying to kill myself");
+	$Apache::lontexconvert::messedup=1;
+	my $request=Apache->request();
+	$request->child_terminate();
+    }
+    return $xmlstring;
 }
 
 # ====================================================================== Footer
@@ -142,27 +142,27 @@
 }
 
 sub smiley {
-   my $expression=shift;
-   if ($ENV{'browser.imagesuppress'} eq 'on') { return $expression; }
-   my %smileys=('\:\-\)' => 'smiley',
-                '8\-\)'  => 'coolsmile',
-                '8\-(I|\|)'   => 'coolindiff',
-                ':\-(I|\|)'   => 'neutral',
-                '\:\-(o|O|\(\))' => 'shocked',
-                ':\-\('  => 'frowny',
-                '\;\-\)' => 'wink',
-                '\:\-P'  => 'baeh',
-                '\:\-(\\\|\\/)' => 'hrrm',
-                '\:\-D'  => 'bigsmile',
-                '\:\-C'  => 'angry',
-                '\:(\'|\`)\-\(' => 'cry',
-                '\:\-(X|\#)' => 'lipsrsealed',
-                '\:\-S' => 'huh');
-   my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
-   foreach (keys %smileys) {
-      $expression=~s/$_/\<img src="$iconpath\/$smileys{$_}.gif" \/\>/gs; 
-   }
-   return $expression;
+    my $expression=shift;
+    if ($ENV{'browser.imagesuppress'} eq 'on') { return $expression; }
+    my %smileys=('\:\-\)' => 'smiley',
+		 '8\-\)'  => 'coolsmile',
+		 '8\-(I|\|)'   => 'coolindiff',
+		 ':\-(I|\|)'   => 'neutral',
+		 '\:\-(o|O|\(\))' => 'shocked',
+		 ':\-\('  => 'frowny',
+		 '\;\-\)' => 'wink',
+		 '\:\-P'  => 'baeh',
+		 '\:\-(\\\|\\/)' => 'hrrm',
+		 '\:\-D'  => 'bigsmile',
+		 '\:\-C'  => 'angry',
+		 '\:(\'|\`)\-\(' => 'cry',
+		 '\:\-(X|\#)' => 'lipsrsealed',
+		 '\:\-S' => 'huh');
+    my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'};
+    foreach (keys %smileys) {
+	$expression=~s/$_/\<img src="$iconpath\/$smileys{$_}.gif" \/\>/gs; 
+    }
+    return $expression;
 }
 
 sub msgtexconverted {