WordPress.org

Ready to get started?Download WordPress

Forums

Texturizer parsing error inside table tags (5 posts)

  1. logoleptic
    Member
    Posted 10 years ago #

    I am using 1.2-RC2 and haven't gotten around to upgrading yet. This may have been fixed in the final version and I just don't know it yet.
    I included a table in a recent post using the following code:
    <table style="border:0;font-family:'Courier New', Courier, monospace;font-size:0.8em;margin-left:auto;margin-right:auto;" cellpadding="2px" cellspacing="1px" id="old-browser-stats">

    <span style="margin-left:1em"><caption style="text-align:center;font-style:italic;margin-left:auto;margin-right:auto;">Hits by Outdated Browsers, May 2004</caption>
    </span>
    <span style="margin-left:1em"><tbody>
    </span>
    <span style="margin-left:1em"><tr>
    </span>
    <span style="margin-left:2em"><th style="text-align:left">Browser</th>
    </span>
    <span style="margin-left:2em"><th style="text-align:right">Hit Count</th>
    </span>
    <span style="margin-left:1em"></tr>
    </span>
    <span style="margin-left:1em"><tr>
    </span>
    <span style="margin-left:2em"><td>Internet Explorer < 6.0</td>
    </span>
    <span style="margin-left:2em"><td style="text-align:right">4607</td>
    </span>
    <span style="margin-left:1em"></tr>
    </span>
    <span style="margin-left:1em"><tr>
    </span>
    <span style="margin-left:2em"><td>Internet Explorer 4.x</td>
    </span>
    <span style="margin-left:2em"><td style="text-align:right">154</td>
    </span>
    <span style="margin-left:1em"></tr>
    </span>
    <span style="margin-left:1em"><tr>
    </span>
    <span style="margin-left:2em"><td>Netscape Navigator 4.x</td>
    </span>
    <span style="margin-left:2em"><td style="text-align:right">638</td>
    </span>
    <span style="margin-left:1em"></tr>
    </span>
    <span style="margin-left:1em"><tr>
    </span>
    <span style="margin-left:2em"><td>WebTV</td>
    </span>
    <span style="margin-left:2em"><td style="text-align:right">16</td>
    </span>
    <span style="margin-left:1em"></tr>
    </span>
    <span style="margin-left:1em"></tbody>
    </span>
    </table>

    When rendered by WordPress, the table's <caption> tag is followed by "", without an opening ". This is keeping the page from validating.
    Ideally (IMO) Texturize should leave code inside the block-level table tag alone, since any line breaks inside that block are probably included for readability rather than visual formatting or structure. It seems to do this just fine, except for the caption tag.
    P.S. Hope I'm getting the name of the XHTML-checking component right here. I know Texturize prettifies punctuation, and I'm making the assumption that it handles other post parsing tasks as well.

  2. logoleptic
    Member
    Posted 10 years ago #

    (vehement, protracted swearing)
    Okay, apparently this BB handles code tags differently than most browsers somehow. Let's try this again...
    <table style="border:0;font-family:'Courier New', Courier, monospace;font-size:0.8em;margin-left:auto;margin-right:auto;" cellpadding="2px" cellspacing="1px" id="old-browser-stats">
    <caption style="text-align:center;font-style:italic;margin-left:auto;margin-right:auto;">Hits by Outdated Browsers, May 2004</caption>
    <tbody>
    <tr>
    <th style="text-align:left">Browser</th>
    <th style="text-align:right">Hit Count</th>
    </tr>
    <tr>
    <td>Internet Explorer < 6.0</td>
    <td style="text-align:right">4607</td>
    </tr>
    <tr>
    <td>Internet Explorer 4.x</td>
    <td style="text-align:right">154</td>
    </tr>
    <tr>
    <td>Netscape Navigator 4.x</td>
    <td style="text-align:right">638</td>
    </tr>
    <tr>
    <td>WebTV</td>
    <td style="text-align:right">16</td>
    </tr>
    </tbody>
    </table>

    The problem is the insertion of a closing p tag after the caption without an opening p tag before. Really, there shouldn't be any p tags at all.
    You can also see the table code in its fully-indented glory here.

  3. johannes
    Member
    Posted 9 years ago #

    Hi,
    in function-formatting.php, around line 61:
    $pee = preg_replace('!(<(?:table|caption|thead|tbody|etc. );
    62;
    pee = preg_replace('!(</(?:table|caption|thead|tbody|etc.);
    67:
    $pee = preg_replace('!\s*(</?(?:table|caption|thead|tbody|etc.);
    71:
    $pee = preg_replace('!\s*(</?(?:table|caption|thead|tbody|etc.);
    72:
    $pee = preg_replace('!(</?(?:table|thead|caption|tbody|etc.);
    74:
    $pee = preg_replace('!(</?(?:table|caption|thead|tbody|etc.);
    than you can use <caption>xy</caption> and it's valide xhtml 1.0 strict.
    best
    johannes

  4. Matt Mullenweg
    Troublemaker
    Posted 9 years ago #

    This has been fixed in CVS.

  5. logoleptic
    Member
    Posted 9 years ago #

    Thanks for the fix, Johannes!
    -- Adam

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.