Hmm, I guess I've exposed a wider issue. I'm happy to write in support
for different text processors, be they markdown, textile, or something
else. Our default, though, should be something easy that we bundle
with the tracks install. Is RedCloth insufficient for this?
On Jun 13, 2008, at 1:59 PM, Thomas Nichols wrote:
> Hi Eric,
>
> irb(main):001:0> require 'redcloth'
> => true
> irb(main):002:0> RedCloth.new("*Goodbye Blue Monday*").to_html
> => "<p><strong>Goodbye Blue Monday</strong></p>"
> irb(main):003:0> require 'maruku'
> => true
> irb(main):004:0> Maruku.new("*Goodbye Blue Monday*").to_html
> => "<p><em>Goodbye Blue Monday</em></p>"
>
>
>
> Since Textile and Markdown syntaxes differ -- in Markdown,
> **strong** and _em_ whereas Textile uses *strong* and _em_ -- I
> don't really grok the code:
>
>> def markdown(text)
>> RedCloth.new(text).to_html
>> end
>
> A separate issue is that although RedCloth _can_ do Markdown, it's a
> very restricted implementation -- hence BlueCloth and Maruku. And
> RDiscount is fantastically fast, but I've had an occasional
> irb(main):003:0> require 'rdiscount'
> => true
> irb(main):004:0> RDiscount.new("*Goodbye Blue Monday*").to_html
> (irb):4: [BUG] Segmentation fault
> ruby 1.8.6 (2008-03-03) [i686-linux]
>
> though usually it gives
> irb(main):001:0> require 'rdiscount'
> => true
> irb(main):002:0> RDiscount.new("*Goodbye Blue Monday*").to_html
> => "<p><em>Goodbye Blue Monday</em></p>\n"
>
> How about a brain-dead solution -- just scribbling a
> class HumaneText; def to_html(string)...end;end
> and then using an environment.rb setting for
> Tracks::TEXT_FORMAT = :rdiscount # :maruku, :bluecloth, :rpeg-
> markdown, :textile
> to decide which processing to apply?
>
> It's not going to win any awards ;-) ... but it would be good enough
> for my needs. What do others want?
>
> Thomas.
>
>
> Eric Allen wrote on 2008/06/13 17:58:
>> Thomas & Walter: They both handle both Markdown and Textile
>> because RedCloth parses both. There will be zero impact on user
>> experience.
>>
>> Reiner: the only difference appears to be hard breaks:
>>
>> def markdown(text)
>> RedCloth.new(text).to_html
>> end
>>
>> 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
>>
>> :hard_breaks means one newline is a <br/> and two makes a paragraph
>>
>>
>> On Jun 13, 2008, at 1:56 AM, Reinier Balt wrote:
>>
>>
>>> It does make sense to keep everything consistent. Is there much
>>> difference between markdown and textilize, besides textilize being
>>> a built-in Rails helper?
>>>
>>> Reinier
>>>
>>> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> ]Namens Eric Allen
>>> Verzonden: vrijdag 13 juni 2008 3:32
>>> Aan: [email protected]
>>> Onderwerp: [Tracks-discuss] textile() vs. markdown()
>>>
>>> I was looking through commit #876 today and noticed that in some
>>> places we use markdown() to invoke RedCloth, and in others we use
>>> textilize(). Does it make sense to keep everything consistent? If
>>> so, it seems to me textilize() would be better, since it's a
>>> built- in Rails helper.
>>>
>>
>> _______________________________________________
>> Tracks-discuss mailing list
>> [email protected]
>> http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
>>
_______________________________________________
Tracks-discuss mailing list
[email protected]
http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss