From jonathan at parkerhill.com Tue May 1 02:00:29 2007 From: jonathan at parkerhill.com (Jonathan Linowes) Date: Tue, 1 May 2007 02:00:29 -0400 Subject: recommendation? Message-ID: <2B6F4CA8-109A-4CD4-B38E-79D644BBEC8D@parkerhill.com> Hi, what's the status of superredcloth? is this the recommended one to use for a live site, or should i hold off and use redcloth "regular" for the time being? I don't feel like being on the "edge", i just want something stable and usable. tia linoj From boss at topfunky.com Tue May 8 12:38:58 2007 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Tue, 8 May 2007 09:38:58 -0700 Subject: Extending SuperRedCloth Message-ID: <15754f7e0705080938u669f83c3sa84f5cf1f7c36243@mail.gmail.com> Fellows of the cloth -- I'm writing code that subclasses RedCloth and emits styled text that is not HTML. For example, I'm going to be emitting RTF and other formats from Textile or Markdown. I've got it working quite well with plainclothed RedCloth, but I can't seem to override any of the methods in SuperRedCloth. Here's a sample: http://pastie.textmate.org/59859 I should see a string of C's for the copyright symbol, but I still see the HTML escape. Will I need to get into the guts of the Ragel scanner to make it do what I want, or am I missing something that can be done in Ruby? Thanks, Geoffrey Grosenbach boss at topfunky.com ........................ Blog | http://nubyonrails.com Podcast | http://podcast.rubyonrails.com Screencast | http://peepcode.com From stephen.bannasch at gmail.com Tue May 8 13:52:51 2007 From: stephen.bannasch at gmail.com (Stephen Bannasch) Date: Tue, 8 May 2007 13:52:51 -0400 Subject: Extending SuperRedCloth In-Reply-To: <15754f7e0705080938u669f83c3sa84f5cf1f7c36243@mail.gmail.com> References: <15754f7e0705080938u669f83c3sa84f5cf1f7c36243@mail.gmail.com> Message-ID: At 9:38 AM -0700 5/8/07, Geoffrey Grosenbach wrote: >Fellows of the cloth -- > >I'm writing code that subclasses RedCloth and emits styled text that >is not HTML. For example, I'm going to be emitting RTF and other >formats from Textile or Markdown. > >I've got it working quite well with plainclothed RedCloth, but I can't >seem to override any of the methods in SuperRedCloth. Here's a sample: > >http://pastie.textmate.org/59859 > >I should see a string of C's for the copyright symbol, but I still see >the HTML escape. > >Will I need to get into the guts of the Ragel scanner to make it do >what I want, or am I missing something that can be done in Ruby? You don't need to change the Ragel scanner but copyright is a class method. from superredcloth.rb: class << SuperRedCloth def copyright opts "©" end end So this works in irb: require 'superredcloth' class SuperRedCloth def self.copyright(opts); "CCCC"; end end SuperRedCloth.new("This is my text (c), I copyrighted it!").to_html => "

This is my textCCCC, I copyrighted it!

" The ragel scanner is calling the SuperRedCloth class methods. I'm not sure what would be the cleanest way to override class methods. -- - Stephen Bannasch Concord Consortium, http://www.concord.org From boss at topfunky.com Tue May 8 14:31:23 2007 From: boss at topfunky.com (Geoffrey Grosenbach) Date: Tue, 8 May 2007 11:31:23 -0700 Subject: Extending SuperRedCloth In-Reply-To: References: <15754f7e0705080938u669f83c3sa84f5cf1f7c36243@mail.gmail.com> Message-ID: <15754f7e0705081131q662bddf5qe39fd0165830371c@mail.gmail.com> On 5/8/07, Stephen Bannasch wrote: > You don't need to change the Ragel scanner but copyright is a class method. Ahh...that makes sense now. In RedCloth most were written as instance methods. I guess the best approach would be to just re-declare the SuperRedCloth class and override all the methods I need. It feels a bit hackish, but works. Thanks, Geoffrey Grosenbach boss at topfunky.com ........................ Blog | http://nubyonrails.com Podcast | http://podcast.rubyonrails.com Screencast | http://peepcode.com From tony.mzungu at gmail.com Sun May 27 19:07:16 2007 From: tony.mzungu at gmail.com (Tony White) Date: Mon, 28 May 2007 02:07:16 +0300 Subject: Stripping out textile markup Message-ID: <5db6eccd0705271607g6deca78v3a031ab7f311549c@mail.gmail.com> Hi, I have several hundred pages of text, all carefully marked up with textile, which I use redcloth to convert to html for display. Now I find I need all these pages to alternatively output plain text - ie. A-Za-z0-9 and simple punctuation only. Any suggestions on the best way to do this? My only thought is to let redcloth do its stuff, and then strip out the html tags - but it feels wrong. Thanks, -- Tony From chris at ozmm.org Sun May 27 19:34:32 2007 From: chris at ozmm.org (Chris Wanstrath) Date: Sun, 27 May 2007 16:34:32 -0700 Subject: Stripping out textile markup In-Reply-To: <5db6eccd0705271607g6deca78v3a031ab7f311549c@mail.gmail.com> References: <5db6eccd0705271607g6deca78v3a031ab7f311549c@mail.gmail.com> Message-ID: <8b73aaca0705271634p62b4ac47l6d8b13f18aa1416a@mail.gmail.com> On 5/27/07, Tony White wrote: > I have several hundred pages of text, all carefully marked up with > textile, which I use redcloth to convert to html for display. Now I > find I need all these pages to alternatively output plain text - ie. > A-Za-z0-9 and simple punctuation only. Any suggestions on the best > way to do this? My only thought is to let redcloth do its stuff, and > then strip out the html tags - but it feels wrong. That's how I do it in acts_as_textiled. -- Chris Wanstrath http://errfree.com // http://errtheblog.com From tony.mzungu at gmail.com Sun May 27 19:50:28 2007 From: tony.mzungu at gmail.com (Tony White) Date: Mon, 28 May 2007 02:50:28 +0300 Subject: Stripping out textile markup In-Reply-To: <8b73aaca0705271634p62b4ac47l6d8b13f18aa1416a@mail.gmail.com> References: <5db6eccd0705271607g6deca78v3a031ab7f311549c@mail.gmail.com> <8b73aaca0705271634p62b4ac47l6d8b13f18aa1416a@mail.gmail.com> Message-ID: <5db6eccd0705271650g14da5aa1u1246b0b4efc156a1@mail.gmail.com> On 28/05/07, Chris Wanstrath wrote: > On 5/27/07, Tony White wrote: > > > I have several hundred pages of text, all carefully marked up with > > textile, which I use redcloth to convert to html for display. Now I > > find I need all these pages to alternatively output plain text - ie. > > A-Za-z0-9 and simple punctuation only. Any suggestions on the best > > way to do this? My only thought is to let redcloth do its stuff, and > > then strip out the html tags - but it feels wrong. > > That's how I do it in acts_as_textiled. > Thanks Chris - I'll have a look at acts_as_textiled tomorrow - it's 3am here, and the power's gone off (for the 3rd time today :-( ) and my ups is about to die! -- Tony From ahodgkin at rowing.org.uk Tue May 29 13:16:25 2007 From: ahodgkin at rowing.org.uk (Andrew Hodgkinson) Date: Tue, 29 May 2007 18:16:25 +0100 Subject: Stripping out textile markup In-Reply-To: <8b73aaca0705271634p62b4ac47l6d8b13f18aa1416a@mail.gmail.com> References: <5db6eccd0705271607g6deca78v3a031ab7f311549c@mail.gmail.com> <8b73aaca0705271634p62b4ac47l6d8b13f18aa1416a@mail.gmail.com> Message-ID: <465C5FE9.9010009@rowing.org.uk> Chris Wanstrath wrote: > That's how I do it in acts_as_textiled. My initial thoughts were that this is a shame, because (at least with a dumb "strip out the tags" conversion) you'd lose the parts of the Textile formatting that work equally well in plain text, such as bullet point lists. But then I remembered that Textile can include HTML tags anyway, so converting from Textile to HTML, then from HTML to text, especially with an intelligent converter, is probably the most sane approach. There's lots of prior art for the latter, especially given that you could (probably) assume the HTML output from the Textile engine to be clean. If I were to be adding PDF export to a Textile-based application I'd probably go via HTML for the same reasons. -- TTFN, Andrew Hodgkinson Find some electronic music at: Photos, wallpaper, software and more: http://pond.org.uk/music.html http://pond.org.uk/