hard_breaks issues

Jean-Baptiste BARTH jeanbaptiste.barth at gmail.com
Tue May 13 16:53:28 EDT 2008


I'm new to this list, so first of all, many thanks to RedCloth's 
developers, it really helps me in many ruby apps :-)

I post here because I'd like to have a clear view on "hard_breaks" 
related issues. I saw old references on the web and on the archives on 
this ML, I'd like a fresh view !
It seems that RedCloth 3.0.4 does not handle "\n" as my previous 
reference (here : http://textism.com/tools/textile/index.php). Actually, 
"hobix.com" website (quoted in the redcloth doc) differs on the "<br>" 
point. So first, can you confirm which is the real reference for the 
Textile "language", and what spec Redcloth follow ?

The latest stable release does everything well for me except "\n" => 
"<br />", it leaves "\n" as is.
I use a very basic code : @blah = RedCloth.new(text_to_parse).to_html
I tried to add the array [:hard_breaks] as a second parameter, but not 
only it does not parse \n "well" (see below), but other features 
disappear, except bold, underline, links and some other transformations. 
Maybe it's the standard behaviour, but in that case, I think I don't 
really understand the second parameter usage...

When I say "does not parse \n well", I mean :
- the sample given on the link above is visually parsed the same way, 
except the "That was a line break" paragraph and some tabulations in 
pre/code sections
- I tried "test\nblah\nbleh" on both, original textile result is 
"\t<p>test<br />\nblah<br />\nbleh</p>" while RedCloth 3.0.4 result is 

Here are the questions :
- is this behaviour normal (according to developper point of view / 
principles) ?
- if not, is it corrected on dev version, or about to be (I saw the name 
"SuperRedCloth" ??) ? and how to test it ?
- would you be interested in a patch that make redcloth 3.0.4 behaviour 
similar to textile php implementation, or it is to be outdated ? I've 
one, strongly inspired from the php class by Alex Shiels. I think it 
works well, but I'm a ruby beginner, the code may be ugly.. Moreover, it 
appears that it is not affected by bug #36 (seen on 
https://code.whytheluckystiff.net/redcloth/, if it is up to date)

Thank you,


Jean-Baptiste BARTH

More information about the Redcloth-upwards mailing list