Two Issues/Bugs Encountered with the tables filter module

cboyd - April 24, 2006 - 04:32
Project:Tables Filter Module
Version:4.6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

First of all, thanks for the tables filter module. It worked reasonably well. But while I was playing around with it, I found 2 issues.

The first issue, is I believe a typo. The code originally hade:

if (count($cells[$j]>$num_cols)) {

I believe what was meant was:

if (count($cells[$j]) > $num_cols) {

I noticed this because sometimes, I'd get the whole table collapsing down to one column. The second issue is one of usability. Basically, I did one off:

[table=tables-my-class
!Header1|!Header2|!Header3
]

And noticed that when I removed the '=tables-my-class' that it would screw up the formatting of the table. When I looked at the source, I saw I was getting spacing elements in some of my header entries and found the code that did this. But it took some tracking down and didn't seem entirely obvious.

I think it would be beneficial to remove empty lines and leading and trailing lines before chopping tablein into row, like this:

    // Before pulling rows rows out, remove empty rows.  Also remove leading
    // and trailing empty rows, since these will mess up the header.
    preg_replace("/\n\+/m", "\n", $tablein);
    $rows=explode("\n", trim($tablein));
     $j=0;
     $num_rows=count($rows);

I've attached a unified patch to the tables.module which should fix these 2 issues.

Regards,
Chris

AttachmentSize
tables.module_1.patch886 bytes

#1

webgeer - April 24, 2006 - 04:47

Hi Chris,

Thanks for your patch.

The first one has already been fixed on 4.7 (Thanks to ascii http://drupal.org/node/57640). However, I am going to have to admit my ignorance on using CVS and say that I have no idea how to patch the 4.6 version available for download...

I will leave this patch here so others can use it until either everybody is using 4.7 or I figure out how to apply the patch.

As for the second part of your submission, I think that is a really good idea and I will do that or something like that to the cvs and 4.7 version soon.

 
 

Drupal is a registered trademark of Dries Buytaert.