Doing that gives me the exact same output that textilize(@body) does.
Textilize(@body) and RedCloth.new(@body, [:hard_breaks]).to_html both
give me:
<p>Test1.<br />Test2.<br />Test3.<br />Test4.</p>
RedCloth.new(@body).to_html (without hard_breaks) gives me:
<p>Test1.</p><p>Test2.</p><p>Test3.
Test4.</p>
I''ve also tried doing a
textilize(@body.gsub("\r\n","<br/>")) to
force one <br/> per line break, but then it screws up things like
bulleted and numbered lists.
On Mar 25, 2006, at 10:31 AM, Dorian Mcfarland wrote:
> try:
>
> sometext = RedCloth.new(@body, :hard_breaks)
> sometext.to_html
>
> although, judging by http://redcloth.rubyforge.org/rdoc/ that
> should be the default behaviour, and the rails
''textilize'' method
> should also do that by default:
>
> # File vendor/rails/actionpack/lib/action_view/helpers/
> text_helper.rb, line 84
> 84: def textilize(text)
> 85: if text.blank?
> 86: ""
> 87: else
> 88: textilized = RedCloth.new(text, [ :hard_breaks ])
> 89: textilized.hard_breaks = true if
> textilized.respond_to?("hard_breaks=")
> 90: textilized.to_html
> 91: end
> 92: end
>
> I''ve had loads of problems with various platforms and hard_breaks.
> what is your actual html output from the various options you tried?
>
>> Knowing that there''s an issue in rails with hard_breaks and
>> textilize, I tried RedCloth.new(@body).to_html, which gave me:
>> Line1.
>> Line2.
>> Line3.Line4.
>> Am I missing something??
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>
> --
> --
> I do things for love or money
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>