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

sakharuk lon-capa-cvs@mail.lon-capa.org
Fri, 18 Apr 2003 15:14:18 -0000


sakharuk		Fri Apr 18 11:14:18 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Changed <th> tag. Now it's almost identical to <td> tag but prints in bold. Additional work may be necessary to resolve some conflicts with the content environments inside of the "internals" of <th> tag.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.129 loncom/xml/londefdef.pm:1.130
--- loncom/xml/londefdef.pm:1.129	Fri Apr 18 11:08:29 2003
+++ loncom/xml/londefdef.pm	Fri Apr 18 11:14:18 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.129 2003/04/18 15:08:29 sakharuk Exp $
+# $Id: londefdef.pm,v 1.130 2003/04/18 15:14:18 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1929,29 +1929,48 @@
 	push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push;
 	$Apache::londefdef::table[-1]{'counter_columns'}++;
 	&Apache::lonxml::startredirection();
-	;
     } 
     return $currentstring;
-}
-        
+}   
+     
 sub end_th {
-    my ($target,$token) = @_;
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $currentstring = '';
     if ($target eq 'web') {
 	$currentstring = $token->[2];     
     } elsif ($target eq 'tex') {
 	my $current_row = $Apache::londefdef::table[-1]{'row_number'};
 	my $data=&Apache::lonxml::endredirection();
-	if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) {                 
-	    $Apache::londefdef::table[-1]{'length'} .= $1.',';             
+	my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0);
+	if (defined $TeXwidth) {		
+	    my $current_length=&recalc($TeXwidth);
+	    $current_length=~/(\d+)/;
+	    $Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';
+	    $Apache::londefdef::table[-1]{'length'} .= '0,';
 	} else {
-	    $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; 
-	}                                                           
-	@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{\textbf{'.$data.'}} '.$Apache::londefdef::table[-1]{'vinc'};
+	    if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) {
+		my $current_length=&recalc($1);
+		$current_length=~/(\d+)/;
+		$Apache::londefdef::table[-1]{'TeXlength'} .= $1.',';
+		$Apache::londefdef::table[-1]{'length'} .= '0,';
+	    } else {     
+		$data=~/^\s*(\S.*)/;
+		$data=$1;
+		$data=~/(.*\S)\s*$/;
+		$data=$1;
+		my $current_length=2*length($data);
+		$Apache::londefdef::table[-1]{'length'} .= $current_length.',';
+		$Apache::londefdef::table[-1]{'TeXlength'} .= '0,';
+	    }        
+	}
+	for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) {                                
+	    $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/;
+	}
+	$data='\textbf{'.$data.'}';
+	@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
     }
     return $currentstring;
 }
-
 #-- <img> tag
 sub start_img {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;