I am using the textilize() helper method and RedCloth 3.04.
I have the following text:
**
Test
Test
**
The ''official'' Textile reference converts that to:
**
<p>Test</p>
<p>Test</p>
**
Rails textilize() method is doing this:
**
<p>Test<br />
Test</p>
**
So, what is producing the different output? Is RedCloth not a 100%
implementation of Textile? Is anyone having trouble with RedCloth 3.0.4?
Hunter
Hi Hunter, 2005/11/1, Hunter Hillegas <lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org>:> I am using the textilize() helper method and RedCloth 3.04. > > I have the following text: > > ** > Test > > Test > ** > > The ''official'' Textile reference converts that to: > > ** > <p>Test</p> > > <p>Test</p> > ** > > Rails textilize() method is doing this: > > ** > <p>Test<br /> > Test</p> > ** > > So, what is producing the different output? Is RedCloth not a 100% > implementation of Textile? Is anyone having trouble with RedCloth 3.0.4?did you solve that? I''m having the same problem :( Greetings, Beate
Beate Paland wrote:> did you solve that? I''m having the same problem :(I saw such discussion earlier. Here I downgraded to 3.0.3 ;-) -- Jean-Christophe Michel
It''s not redcloth, it''s rails...
def textilize(text)
if text.blank?
""
else
textilized = RedCloth.new(text, [ :hard_breaks ])
textilized.hard_breaks = true if
textilized.respond_to?("hard_breaks=")
textilized.to_html
end
end
I''m not sure why this isn''t configurable, but it''s
hard coded to use
hard_breaks.
you can fix it by making your own helper that doesn''t pass :hard_breaks
in.
something like:
def textilize_without_hard_breaks(text)
text = RedCloth.new(text)
return text.to_html
end
(only hopefully with a better name)
On Wed, 2005-11-23 at 16:31 +0100, Jean-Christophe Michel
wrote:> Beate Paland wrote:
> > did you solve that? I''m having the same problem :(
>
> I saw such discussion earlier. Here I downgraded to 3.0.3 ;-)
>
To clarify, It does look like there is a problem with hardbreak handling in the current redcloth version... I don''t believe enabling hardbreaks is supposed to disable paragraphs :P But it''d be nice to be able to pass redcloth options to textilize. On Wed, 2005-11-23 at 10:06 -0800, Jerrett Taylor wrote:> It''s not redcloth, it''s rails... > > > def textilize(text) > if text.blank? > "" > else > textilized = RedCloth.new(text, [ :hard_breaks ]) > textilized.hard_breaks = true if > textilized.respond_to?("hard_breaks=") > textilized.to_html > end > end > > > I''m not sure why this isn''t configurable, but it''s hard coded to use > hard_breaks. > > > you can fix it by making your own helper that doesn''t pass :hard_breaks > in. > > something like: > > > > def textilize_without_hard_breaks(text) > text = RedCloth.new(text) > return text.to_html > end > > > (only hopefully with a better name) > > > On Wed, 2005-11-23 at 16:31 +0100, Jean-Christophe Michel wrote: > > Beate Paland wrote: > > > did you solve that? I''m having the same problem :( > > > > I saw such discussion earlier. Here I downgraded to 3.0.3 ;-) > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I always thought a single line break should convert to <br> and a double line break to <p> - I was also having a problem with this and had to resort to my own helper method. Cheers Luke On 11/23/05, Jerrett Taylor <jerrett-7g3wz9A/6AxWk0Htik3J/w@public.gmane.org> wrote:> > To clarify, It does look like there is a problem with hardbreak handling > in the current redcloth version... I don''t believe enabling hardbreaks > is supposed to disable paragraphs :P > > But it''d be nice to be able to pass redcloth options to textilize. > > > On Wed, 2005-11-23 at 10:06 -0800, Jerrett Taylor wrote: > > It''s not redcloth, it''s rails... > > > > > > def textilize(text) > > if text.blank? > > "" > > else > > textilized = RedCloth.new(text, [ :hard_breaks ]) > > textilized.hard_breaks = true if > > textilized.respond_to?("hard_breaks=") > > textilized.to_html > > end > > end > > > > > > I''m not sure why this isn''t configurable, but it''s hard coded to use > > hard_breaks. > > > > > > you can fix it by making your own helper that doesn''t pass :hard_breaks > > in. > > > > something like: > > > > > > > > def textilize_without_hard_breaks(text) > > text = RedCloth.new(text) > > return text.to_html > > end > > > > > > (only hopefully with a better name) > > > > > > On Wed, 2005-11-23 at 16:31 +0100, Jean-Christophe Michel wrote: > > > Beate Paland wrote: > > > > did you solve that? I''m having the same problem :( > > > > > > I saw such discussion earlier. Here I downgraded to 3.0.3 ;-) > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I have a similar issue using 3.0.4. If I have something like: h1. This is a header <p> This is a paragraph </p> It includes "This is a paragraph" as part of the header. If I don''t have the CR after the word "header", it works ok. i.e. h1. This is a header<p>This is a paragraph</p> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---