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

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 25 Jul 2002 15:28:26 -0000


sakharuk		Thu Jul 25 11:28:26 2002 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Added corrections to print even 'stupid' tables as in the case of 
  Ray's course (stupid = tables with a lot of ampty columns manually adjusted. It's stupid becouse you can easily specify the length of the cell).
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.77 loncom/xml/londefdef.pm:1.78
--- loncom/xml/londefdef.pm:1.77	Wed Jul 24 16:23:21 2002
+++ loncom/xml/londefdef.pm	Thu Jul 25 11:28:26 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.77 2002/07/24 20:23:21 sakharuk Exp $
+# $Id: londefdef.pm,v 1.78 2002/07/25 15:28:26 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1318,7 +1318,7 @@
 		    $output .= ' \\\\ ';
 		}
                 my @length = split(/,/,$Apache::londefdef::table[-1]{'length'});
-                my $how_many_columns = $#length+1;
+                my $how_many_columns = $#length;
                 my $parboxlength = '(\textwidth';
                 for (my $io=0; $io<=$#length;$io++) {
 		    if ($length[$io] ne '') {
@@ -1356,7 +1356,7 @@
 		}
 		push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'});
 		$Apache::londefdef::table[-1]{'counter_columns'} = -1;
-		$Apache::londefdef::table[-1]{'length'} = ''; #just added
+		$Apache::londefdef::table[-1]{'length'} = ''; 
 
 	    } 
 	   return $currentstring;
@@ -1397,9 +1397,11 @@
 	    } 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))/) {                 #just added
-                    $Apache::londefdef::table[-1]{'length'} .= $1.',';             #just added
-		}                                                                  #just added
+		if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) {                 
+                    $Apache::londefdef::table[-1]{'length'} .= $1.',';             
+		} else {
+		    $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; 
+                }                                                                 
 		@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'};
 	    }
 	   return $currentstring;
@@ -1430,9 +1432,11 @@
 	    } 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))/) {                 #just added
-                    $Apache::londefdef::table[-1]{'length'} .= $1.',';             #just added
-		}                                                                  #just added
+		if ($data=~m/width\s*=\s*(\d+\.*\d*\s*(mm|cm))/) {                 
+                    $Apache::londefdef::table[-1]{'length'} .= $1.',';             
+		} else {
+		    $Apache::londefdef::table[-1]{'length'} .= '0 mm,'; 
+                }                                                           
 		@{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{'.$1.'}{\textbf{'.$data.'}} '.$Apache::londefdef::table[-1]{'vinc'};
 	    }
 	   return $currentstring;