version 1.10, 2009/04/17 20:17:48
|
version 1.11, 2010/08/11 10:57:36
|
Line 265 sub new {
|
Line 265 sub new {
|
outer_border => 0, |
outer_border => 0, |
inner_border => 0, |
inner_border => 0, |
caption => "", |
caption => "", |
theme => "Zurich", |
theme => "plain", |
column_count => 0, |
column_count => 0, |
row_open => 0, |
row_open => 0, |
rows => [], |
rows => [], |
Line 733 sub generate {
|
Line 733 sub generate {
|
my $table = LaTeX::Table->new(); |
my $table = LaTeX::Table->new(); |
$table->set_center(0); # loncapa tables don't float. |
$table->set_center(0); # loncapa tables don't float. |
$table->set_environment(0); |
$table->set_environment(0); |
|
$table->set_theme($this->{'theme'}); |
|
|
|
|
# Add the caption if supplied. |
# Add the caption if supplied. |
Line 761 sub generate {
|
Line 762 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'}; |
|
|
|
# Add a top line if the outer or inner border is enabled: |
|
|
|
if ($outer_border || $inner_border) { |
|
push(@data, ["\\cline{1-$column_count}"]); |
|
|
|
} |
|
|
for (my $row = 0; $row < $row_count; $row++) { |
for (my $row = 0; $row < $row_count; $row++) { |
my @row; |
my @row; |
my $cells = $rows->[$row]->{'cells'}; |
my $cells = $rows->[$row]->{'cells'}; |
Line 770 sub generate {
|
Line 778 sub generate {
|
my @underlines; # Array of \cline cells if cellborder on. |
my @underlines; # Array of \cline cells if cellborder on. |
|
|
|
|
|
|
for (my $cell = 0; $cell < $cell_count; $cell++) { |
for (my $cell = 0; $cell < $cell_count; $cell++) { |
my $contents = $cells->[$cell]->{'contents'}; |
my $contents = $cells->[$cell]->{'contents'}; |
|
|
Line 838 sub generate {
|
Line 847 sub generate {
|
} |
} |
} |
} |
if ($inner_border && ($cells->[$cell]->{'rowspan'} == 1)) { |
if ($inner_border && ($cells->[$cell]->{'rowspan'} == 1)) { |
|
&Apache::lonnet::logthis("Pushing underlines $inner_border"); |
my $lastcol = $nextcol -1; |
my $lastcol = $nextcol -1; |
push(@underlines, "\\cline{$startcol-$lastcol}"); |
push(@underlines, "\\cline{$startcol-$lastcol}"); |
} |
} |
Line 849 sub generate {
|
Line 859 sub generate {
|
} |
} |
push(@data, \@row); |
push(@data, \@row); |
if ($inner_border) { |
if ($inner_border) { |
|
&Apache::lonnet::logthis("Pushing underlines with inner_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]]); |
} |
} |
} |
} |
|
|
} |
} |
|
# |
|
# 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) { |
|
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 || $inner_border) { |
|
&Apache::lonnet::logthis("adding | $outer_border : $inner_border"); |
$coldef .= '|'; |
$coldef .= '|'; |
} |
} |
for (my $i =0; $i < $column_count; $i++) { |
for (my $i =0; $i < $column_count; $i++) { |