<pre>
<table>
<tbody>
<tr><td>foo</td><td>bar</td></tr>
</tbody>
</table>
</pre>
is turned by WordPress into:
<pre>
<table>
<tbody>
<tr>
<td>foo</td>
<td>bar</td>
</tr>
</tbody>
</table>
</pre>
What a mess!
<pre>
<table>
<tbody>
<tr><td>foo</td><td>bar</td></tr>
</tbody>
</table>
</pre>
is turned by WordPress into:
<pre>
<table>
<tbody>
<tr>
<td>foo</td>
<td>bar</td>
</tr>
</tbody>
</table>
</pre>
What a mess!
I disagree, it isn't a bug, it's the way it works.
For starters, before WP displays a post, it opens P tag. Then anytime a blank line is encountered, it closes the current P tag and opens another. Between your table and tbody is blank line, so WP closed the current P tag at that time and opened another.
Try putting your table all on one line, or at least with no blank lines between.
Although it does raise an interesting question: If someone should want to display tablualr data, what/how would it be easiest withing WP?
TG
techgnome I disagree :D
it seems "the way it works" isn't working in this case and therefore it should get attention and be rectified.
solution:
1) encapsulate html user input with [html] [/html] markers and make WP NOT add p and br tags (e107 uses this option)
2) parse user input and do a CASE in WP adding br / p tags only when adjacent lines are NON HTML
3) make separate input fields for html or text only data when posting.
4) etc etc
it is a "bug", a "deficiency", one that can be rectified if there's need to do so. option1 would be a fast and easy way to do it.
tabular data? well it would be cool to be able to have input forms based on table templates where you enter your data into text fields and they'll be placed in the respective cells, that of course would mean that each table template needs to be stored in the DB and each instance of that template needs it's own line in that table. very much doable. it could come with a few default table layout templates to work with or from. the best thing about this is that users will never actually have to worry about table structures or layout, they just enter their cell/row data into text fields.
very spiffy stuff. hmm, maybe I code a WP-TTGen .. if I only had more time :D
Ihad.
I've been griping about this one for a long time, there is some new auto-formatting code being looked at that solves this, but causes other problems. Somewhere in the middle is about right - if I knew more reg-ex, I'd try to fix it again (I've spent about 8-10 fruitless hours so far).
The quick fix I've been asking for (maybe I'll try to add it with Dougal's new post meta) is just the ability to turn the auto-formatting off on a per post basis.
This is a bug, and if you post the code that gave you trouble to the wiki I'll take a look at it. However I believe the tbody problem has been fixed already.
http://wiki.wordpress.org/index.php/autop-bugs
Ok, done, along with a suggestion for fixing it. (No configurability necessary!)
Was there ever a solution to this issue?
Writing a long <TABLE>...</TABLE> all on one line makes it near impossible to edit later on.
I looked at the "autop-bugs" page but it didn't give me any answer - not sure what the "verbatim tag" is.
Posted a minute too soon ;)
Apparently the WordPress editor doesn't take any notice of <verbatim> ... </verbatim> but it seems there's a similar <pre> ... </pre> pair which works to stop WordPress putting <br> etc in my tables. Success.
This topic has been closed to new replies.