Hardbreaks and Redcloth

There seems to be just no way to do this correctly.
I store my the RedCloth rendered (html) in a row. Lots of the strings
include something along the lines of “\n\n\n\n\n\n\n\n\n\n\n”. And
whatever I do, I cannot get it to work without breaking or causing poor
format of lists (IE. an extra
after each. So I ask, anyone come
up with a way they know of? Any alternative markup language like Rails
UBB, Markdown (BlueCloth do a good job with hardbreaks, my experience it
dosn’t do any better), even a script that handles HTML well (I.E.
entities, renders broken tags as text)?

After trying everything I could find without having to make yet another
post about this topic I tried using gsub!("\n",
’) and editing:

def clean_white_space( text )
# normalize line breaks
#text.gsub!( /\r\n/, “\n” )
#text.gsub!( /\r/, “\n” )
text.gsub!( /\t/, ’ ’ )
text.gsub!( /^ +$/, ‘’ )
#text.gsub!( /\n{3,}/, “\n\n” )
text.gsub!( /"$/, “” " )

just experimenting to see what works, whatever combination breaks Lists.
I also tried editing the Lists function to no avail.

Something that edits the \n >= 3 and then adds that many
work but I don’t know regexp well enough to do that effectively.

So any suggestions would be appreciated.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs