#33 ✓resolved
Stephen

HTML added directly causes textile tables to go wrong

Reported by Stephen | August 5th, 2008 @ 02:21 PM | in 4.0.2

I've come across a problem where tables end up with a spurious extra table tag in the HTML generated by RedCloth.

This only seems to occur when you also have some HTML entered in directly as part of the source content that RedCloth is parsing.

The following works as expected...

RedCloth.new("h2. heading\n\n|a|b|c|\n|d|e|f|\n").to_html

It returns...

<h2>heading</h2>
<table>
<tr><td>a</td><td>b</td><td>c</td></tr>
<tr><td>d</td><td>e</td><td>f</td></tr>
</table>

But if we add an HTML bold tag at the start we get an extra opening table tag in the resultant HTML.

RedCloth.new("<b></b>\nh2. plop\n\n|a|b|c|\n|d|e|f|\n").to_html

...returns...

<p><b>foo</b></p>
<h2>heading</h2>
<table>
<table>
<tr><td>a</td><td>b</td><td>c</td></tr>
<tr><td>d</td><td>e</td><td>f</td></tr>
</table>

Notice the two opening table tags.

I've tried this directly in irb running v4.0.1.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RedCloth is a Ruby library for converting Textile into HTML

Shared Ticket Bins

People watching this ticket

Referenced by

Pages