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