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

raeburn raeburn@source.lon-capa.org
Thu, 18 Nov 2010 17:12:14 -0000


raeburn		Thu Nov 18 17:12:14 2010 EDT

  Modified files:              
    /loncom/xml	lontable.pm 
  Log:
  - prevent divide-by-zero error
  - duplicate declaration for $cw
  
  
Index: loncom/xml/lontable.pm
diff -u loncom/xml/lontable.pm:1.14 loncom/xml/lontable.pm:1.15
--- loncom/xml/lontable.pm:1.14	Mon Nov  1 10:52:09 2010
+++ loncom/xml/lontable.pm	Thu Nov 18 17:12:14 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 #  Generating TeX tables.
 #
-# $Id: lontable.pm,v 1.14 2010/11/01 10:52:09 foxr Exp $
+# $Id: lontable.pm,v 1.15 2010/11/18 17:12:14 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -684,6 +684,9 @@
     
     if (defined($config)) {
 	foreach my $key (keys(%$config)) {
+            if ($key eq 'colspan') {
+                next if ($config->{$key} == 0);
+            }
 	    $cell->{$key} = $config->{$key};
 	}
     }
@@ -900,7 +903,7 @@
 		} else {
 		    $cw = $default_width;
 		}
-		my $cw = $cw * $cells->[$cell]->{'colspan'};
+		$cw = $cw * $cells->[$cell]->{'colspan'};
 		$col_align = "p{$cw $colunits}";
 		$contents = $embeddedAlignStart . $contents .  $embeddedAlignEnd;
 	    }