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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 13 Aug 2003 18:57:28 -0000


albertel		Wed Aug 13 14:57:28 2003 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
    /loncom/xml	lonxml.pm 
  Log:
  - cleanup latex_special_symbols call (unnneeded middle parameters)
  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.210 loncom/interface/lonprintout.pm:1.211
--- loncom/interface/lonprintout.pm:1.210	Wed Aug 13 13:38:55 2003
+++ loncom/interface/lonprintout.pm	Wed Aug 13 14:57:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.210 2003/08/13 17:38:55 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.211 2003/08/13 18:57:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -468,8 +468,7 @@
     if (!defined($udom)) { $uname=$ENV{'user.domain'}; }
     my $plainname=&Apache::loncommon::plainname($uname,$udom);
     if ($plainname=~/^\s*$/) { $plainname=$uname; }
-    return &Apache::lonxml::latex_special_symbols($plainname,undef,undef,
-						  'header');
+    return &Apache::lonxml::latex_special_symbols($plainname,'header');
 }
 
 
@@ -484,10 +483,9 @@
 	}
     my $name = &get_name();
     if ($name =~ /^\s*$/) {
-	$name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},undef,
-						     undef,'header');
+	$name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},'header');
     }
-    my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header');
+    my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'header');
     if ($layout eq 'album') {
 	my $topmargintoinsert = '';
 	if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}
@@ -714,10 +712,9 @@
 	    if (($selectionmade == 4) and ($assignment ne $prevassignment) and ($i>=1)) {
 		my $name = &get_name();
 		if ($name =~ /^\s*$/) {
-		    $name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},undef,
-								 undef,'header');
+		    $name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},'header');
 		}
-		my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header');
+		my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'header');
 		$prevassignment=$assignment;
 		$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}} - '.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip -5 mm ';
 	    }
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.271 loncom/xml/lonxml.pm:1.272
--- loncom/xml/lonxml.pm:1.271	Wed Aug 13 10:23:37 2003
+++ loncom/xml/lonxml.pm	Wed Aug 13 14:57:28 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.271 2003/08/13 14:23:37 www Exp $
+# $Id: lonxml.pm,v 1.272 2003/08/13 18:57:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -478,24 +478,24 @@
 }
 
 sub latex_special_symbols {
-    my ($current_token,$stack,$parstack,$where)=@_;
+    my ($string,$where)=@_;
     if ($where eq 'header') {
-	$current_token =~ s/(\\|_|\^)/ /g;
-	$current_token =~ s/(\$|%|\#|&|\{|\})/\\$1/g;
+	$string =~ s/(\\|_|\^)/ /g;
+	$string =~ s/(\$|%|\#|&|\{|\})/\\$1/g;
     } else {
-	$current_token=~s/\\ /\\char92 /g;
-	$current_token=~s/\^/\\char94 /g;
-	$current_token=~s/\~/\\char126 /g;
-	$current_token=~s/(&[^A-Za-z\#])/\\$1/g;
-	$current_token=~s/([^&])\#/$1\\#/g;
-	$current_token=~s/(\$|_|{|})/\\$1/g;
-	$current_token=~s/\\char92 /\\texttt{\\char92}/g;
-	$current_token=~s/(>|<)/\$$1\$/g; #more or less
-	if ($current_token=~m/\d%/) {$current_token =~ s/(\d)%/$1\\%/g;} #percent after digit
-	if ($current_token=~m/\s%/) {$current_token =~ s/(\s)%/$1\\%/g;} #persent after space
-	if ($current_token eq '%.') {$current_token = '\%.';} #persent at the end of statement
+	$string=~s/\\ /\\char92 /g;
+	$string=~s/\^/\\char94 /g;
+	$string=~s/\~/\\char126 /g;
+	$string=~s/(&[^A-Za-z\#])/\\$1/g;
+	$string=~s/([^&])\#/$1\\#/g;
+	$string=~s/(\$|_|{|})/\\$1/g;
+	$string=~s/\\char92 /\\texttt{\\char92}/g;
+	$string=~s/(>|<)/\$$1\$/g; #more or less
+	if ($string=~m/\d%/) {$string =~ s/(\d)%/$1\\%/g;} #percent after digit
+	if ($string=~m/\s%/) {$string =~ s/(\s)%/$1\\%/g;} #percent after space
+	if ($string eq '%.') {$string = '\%.';} #percent at the end of statement
     }
-    return $current_token;
+    return $string;
 }
 
 sub inner_xmlparse {
@@ -585,7 +585,7 @@
       if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) {
 	  #Style file definitions should be correct
 	  if ($target eq 'tex' && ($Apache::lonxml::usestyle)) {
-	      $result=&latex_special_symbols($result,$stack,$parstack);
+	      $result=&latex_special_symbols($result);
 	  }
       }