--- lib/HTML/FormatText/WithLinks/AndTables.pm.orig 2011-07-22 16:10:51.000000000 +0200
+++ lib/HTML/FormatText/WithLinks/AndTables.pm 2011-07-22 16:14:09.000000000 +0200
@@ -134,7 +134,7 @@
for my $tr (@trs) { # *** 1st pass over rows
$max_col_heights[$row_count] = 0;
$col_lines[$row_count] = [];
- my @cols = $tr->look_down(_tag=>'td'); # no support for <th>. sorry.
+ my @cols = $tr->look_down(_tag=>qr/(td|th)/);
for (my $i = 0; $i < scalar @cols; $i++) {
my $td = $cols[$i]->clone;
my $new_tree = HTML::TreeBuilder->new;
@@ -167,7 +167,7 @@
SECOND_PASS: {
my $row_count = 0; # obviously, another counter...
for my $tr (@trs) { # *** 2nd pass over rows
- my @cols = $tr->look_down(_tag=>'td'); # no support for <th>. sorry.
+ my @cols = $tr->look_down(_tag=>qr/(td|th)/);
my $row_text; # the final string representing each row of reformatted text
@@ -212,7 +212,9 @@
}
# put the fully formatted text into our accumulator
$formatted_tables->[$table_count]->[$row_count] = $row_text;
- $cols[0]->content->[0] = "__TOKEN__${table_count}__${row_count}__"; # place a token into the row at col 0
+ if (ref($cols[0])) {
+ $cols[0]->content->[0] = "__TOKEN__${table_count}__${row_count}__"; # place a token into the row at col 0
+ }
$row_count++;
}
}