[ic] Usertag: table_organize question

Gary Norton gnorton at broadgap.com
Tue Jan 25 05:00:45 EST 2005


I am working on updating my modules to validate against XHTML 1.0 
Transitional and want to make a change to the table_organize tag.

Tags are case sensitive in XHTML so I need to change <TD> to <td> and 
</TD> to </td> (the embed function of table_organize requires the case 
differences in order to determine which code it should manipulate, and 
which code it should not).

Here is the current code:

     elsif($opt->{embed}) {
                if($opt->{embed} eq 'lc') {
                        push @cells, $1 while $body =~ s:(<td\b.*?</td>)::s;
                }
                else {
                        push @cells, $1 while $body =~ 
s:(<TD\b.*?</TD>)::s;  *********** I belive this is the line I 
need***************
                }
        }
        else {
                push @cells, $1 while $body =~ s:(<td\b.*?</td>)::is;
        }

I tried to search for regex syntax on the "s:" notation (didn't know the 
proper terminiology, so results were sparce). It seems that this syntax 
is deprecated in favor of the s///s (I am making an assumption that the 
trailing "s" is for singleline).  So with that basis, I tried this:

 elsif($opt->{embed}) {
                if($opt->{embed} eq 'lc') {
                        push @cells, $1 while $body =~ s:(<td\b.*?</td>)::s;
                }
                else {
                         push @cells, $1 while $body =~ 
s:(<TD\b.*?</TD>):(<td\b.*?</td>) :s;  *********** This is what I 
changed it to ***************
                }
        }
        else {
                push @cells, $1 while $body =~ s:(<td\b.*?</td>)::is;
        }

   

Needless to say, it didn't work. It strips the entire line out of the 
resulting html (throwing off the table layout).

Can anyone give  me a bit of help here on this? Have I made the correct 
assumptions about the s:::s syntax?

TIA,
Gary



More information about the interchange-users mailing list