--- loncom/xml/lontable.pm 2010/11/18 17:12:14 1.15 +++ loncom/xml/lontable.pm 2011/04/05 10:02:58 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Generating TeX tables. # -# $Id: lontable.pm,v 1.15 2010/11/18 17:12:14 raeburn Exp $ +# $Id: lontable.pm,v 1.16 2011/04/05 10:02:58 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -347,6 +347,20 @@ Set or get the presence of a request for drawn around them. If a paramter is passed, it will be treated as a new value for the cell border configuration. Regardless,the final 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: @@ -846,9 +860,12 @@ sub generate { my $outer_border = $this->{'outer_border'}; 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: - if ($outer_border || $inner_border) { + if ($outer_border || $cell_ul_border) { push(@data, ["\\cline{1-$column_count}"]); } @@ -908,10 +925,10 @@ sub generate { $contents = $embeddedAlignStart . $contents . $embeddedAlignEnd; } - if ($inner_border || ($outer_border && ($cell == 0))) { + if ($cell_lr_border || ($outer_border && ($cell == 0))) { $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.'|'; } @@ -935,7 +952,7 @@ sub generate { $contents .= ' \\\\'; } } - if ($inner_border && ($cells->[$cell]->{'rowspan'} == 1)) { + if ($cell_ul_border && ($cells->[$cell]->{'rowspan'} == 1)) { my $lastcol = $nextcol -1; push(@underlines, "\\cline{$startcol-$lastcol}"); } @@ -946,7 +963,7 @@ sub generate { } push(@data, \@row); - if ($inner_border) { + if ($cell_ul_border) { for (my $i =0; $i < scalar(@underlines); $i++) { push(@data, [$underlines[$i]]); } @@ -957,14 +974,14 @@ sub generate { # Add bottom border if necessary: if the inner border was on, the loops above # 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}"]); } $table->set_data(\@data); my $coldef = ""; - if ($outer_border || $inner_border) { + if ($outer_border || $cell_lr_border) { $coldef .= '|'; } for (my $i =0; $i < $column_count; $i++) { @@ -973,7 +990,7 @@ sub generate { } else { $coldef .= 'l'; } - if ($inner_border || + if ($cell_lr_border || ($outer_border && ($i == $column_count-1))) { $coldef .= '|'; }