Diff for /loncom/xml/lontable.pm between versions 1.14 and 1.16

version 1.14, 2010/11/01 10:52:09 version 1.16, 2011/04/05 10:02:58
Line 347  Set or get the presence of a request for Line 347  Set or get the presence of a request for
 drawn around them.  If a paramter is passed, it will be treated as  drawn around them.  If a paramter is passed, it will be treated as
 a new value for the cell border configuration.  Regardless,the final  a new value for the cell border configuration.  Regardless,the final
 value of that configuration parameter is returned.  value of that configuration parameter is returned.
   Valid values for the parameter are:
   
   =over 2
   
   =item 0 - no borders present.
   
   =item 1 - All borders (borders around all four sides of the cell.
   
   =item 2 - Border at top and bottom of the cell.
   
   =item 3 - Border at the left and right sides of the cell.
   
   
   =over -2 
   
 =head3 Examples:  =head3 Examples:
   
Line 684  sub add_cell { Line 698  sub add_cell {
           
     if (defined($config)) {      if (defined($config)) {
  foreach my $key (keys(%$config)) {   foreach my $key (keys(%$config)) {
               if ($key eq 'colspan') {
                   next if ($config->{$key} == 0);
               }
     $cell->{$key} = $config->{$key};      $cell->{$key} = $config->{$key};
  }   }
     }      }
Line 843  sub generate { Line 860  sub generate {
     my $outer_border = $this->{'outer_border'};      my $outer_border = $this->{'outer_border'};
     my $column_count = $this->{'column_count'};      my $column_count = $this->{'column_count'};
   
       my $cell_ul_border = (($inner_border == 1) || ($inner_border == 2)) ? 1 : 0;
       my $cell_lr_border = (($inner_border == 1) || ($inner_border == 3)) ? 1 : 0;
    
     # Add a top line if the outer or inner border is enabled:      # Add a top line if the outer or inner border is enabled:
   
     if ($outer_border || $inner_border) {      if ($outer_border || $cell_ul_border) {
  push(@data, ["\\cline{1-$column_count}"]);        push(@data, ["\\cline{1-$column_count}"]);     
   
     }      }
Line 900  sub generate { Line 920  sub generate {
  } else {   } else {
     $cw = $default_width;      $cw = $default_width;
  }   }
  my $cw = $cw * $cells->[$cell]->{'colspan'};   $cw = $cw * $cells->[$cell]->{'colspan'};
  $col_align = "p{$cw $colunits}";   $col_align = "p{$cw $colunits}";
  $contents = $embeddedAlignStart . $contents .  $embeddedAlignEnd;   $contents = $embeddedAlignStart . $contents .  $embeddedAlignEnd;
     }      }
   
     if ($inner_border || ($outer_border && ($cell == 0))) {      if ($cell_lr_border || ($outer_border && ($cell == 0))) {
  $col_align = '|'.$col_align;   $col_align = '|'.$col_align;
     }      }
     if ($inner_border || ($outer_border && ($cell == ($cell_count -1)))) {      if ($cell_lr_border || ($outer_border && ($cell == ($cell_count -1)))) {
  $col_align = $col_align.'|';   $col_align = $col_align.'|';
     }      }
   
Line 932  sub generate { Line 952  sub generate {
     $contents .= '  \\\\';      $contents .= '  \\\\';
  }   }
     }      }
     if ($inner_border && ($cells->[$cell]->{'rowspan'} == 1)) {      if ($cell_ul_border && ($cells->[$cell]->{'rowspan'} == 1)) {
  my $lastcol = $nextcol -1;   my $lastcol = $nextcol -1;
  push(@underlines, "\\cline{$startcol-$lastcol}");   push(@underlines, "\\cline{$startcol-$lastcol}");
     }      }
Line 943  sub generate { Line 963  sub generate {
   
  }   }
  push(@data, \@row);   push(@data, \@row);
  if ($inner_border) {   if ($cell_ul_border) {
     for (my $i =0; $i < scalar(@underlines); $i++) {      for (my $i =0; $i < scalar(@underlines); $i++) {
  push(@data, [$underlines[$i]]);   push(@data, [$underlines[$i]]);
     }      }
Line 954  sub generate { Line 974  sub generate {
     # Add bottom border if necessary: if the inner border was on, the loops above      # Add bottom border if necessary: if the inner border was on, the loops above
     # will have done a bottom line under the last cell.      # will have done a bottom line under the last cell.
     #      #
     if ($outer_border && !$inner_border) {      if ($outer_border && !$cell_ul_border) {
  push(@data, ["\\cline{1-$column_count}"]);        push(@data, ["\\cline{1-$column_count}"]);     
   
     }      }
     $table->set_data(\@data);      $table->set_data(\@data);
           
     my $coldef = "";      my $coldef = "";
     if ($outer_border || $inner_border) {      if ($outer_border || $cell_lr_border) {
  $coldef .= '|';   $coldef .= '|';
     }      }
     for (my $i =0; $i < $column_count; $i++) {      for (my $i =0; $i < $column_count; $i++) {
Line 970  sub generate { Line 990  sub generate {
  } else {   } else {
     $coldef .= 'l';      $coldef .= 'l';
  }   }
  if ($inner_border ||    if ($cell_lr_border || 
     ($outer_border && ($i == $column_count-1))) {      ($outer_border && ($i == $column_count-1))) {
     $coldef .= '|';      $coldef .= '|';
  }   }

Removed from v.1.14  
changed lines
  Added in v.1.16


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>