views:

127

answers:

2

I am using RedCloth with Rails 2.1.1. The Textile <del> tag markup format (i.e. -delete-) was not translating at all. Tried a few choice options.

> x=RedCloth.new('foobar -blah-')
=> "foobar -blah-"
> x.to_html
=> "<p>foobar <del>blah</del></p>"  # WORKED!
> x=RedCloth.new('foobar * -blah-')
=> "foobar * -blah-"
> x.to_html
=> "<p>foobar * <del>blah</del></p>"  # WORKED!
> x=RedCloth.new("foobar\n* -blah-")
=> "foobar\n* -blah-"
> x.to_html
=> "<p>foobar</p>\n<ul>\n\t<li>-blah-</li>\n</ul>"  # DID NOT WORK!

It appears to me that newlines are the culprit in throwing RedCloth up-in-arms. Any solutions to getting RedCloth to properly recognize '-delete-'? I have tried RedCloth 4.0.1, 4.0.3, and 4.0.4.

+2  A: 

Looks like RedCloth needs a little more syntax to interpret the delete tag as the first element after a list item...

>> RedCloth.new("foobar\n* [-blah-]").to_html
=> "<p>foobar</p>\n<ul>\n\t<li><del>blah</del></li>\n</ul>"
Michael Sepcot
A: 

This is because a star on a new line represents a list item, and it is ignoring delete markers without explicitly telling it to render them as Michael points out.

Ian Terrell