Is there a way in RedCloth to go from text with Textile markup in it to plain text without the markup? Not just <pre> or <notextile> that passes it through, but actually strips out the textile markup glyphs so something like *word* ends up just being word in the output? thanks.
on 2008-04-23 21:56
on 2008-04-23 22:26
No, not currently. You could write a plain text formatter like the HTML formatter in (the forthcoming) RedCloth 4.0. Then you rewrite the methods so it passes through the text you want but doesn't add HTML. If you want to hack on it, fork the project on github and let me know when you have something interesting. Out of curiousity, what are you using this for?
on 2008-04-24 04:08
The site I'm working on has a batch email function and I'd like the user to be able to user Textile for creating their HTML formatted email. However, I've set up action mailer to do multipart emails in case recipient is on a plain text client. So, for the HTML mailer template I use the .to_html output for the body text, and for the plain text mailer template I want to strip out the markup. Right now I'm just sending through the marked up text, which isn't horrible if you keep it simple, but links, for instance, really come through badly. Thanks for the input.
on 2008-04-24 15:21
Okay, that's what I suspected. I have had that need at times too. Maybe it would be nice, instead of just outputting the text with no formatting, to do a little plain text formatting exclusively for human consumption (unlike Textile or Markdown). Like: Header 1 ======= This is a link (http://code.whytheluckystiff.net/redcloth) and perhaps some *bold* text. Now, you specifically *didn't* want the asterisks around bold phrases, didn't you? What do you think?
on 2008-04-24 16:59
Not so much _I_ didn't want the asterisks, but client does not like the output that way. I think I see what you're getting at, though - would this be a matter of setting up custom RedCloth rules to apply the "plain text" formatting they want to end up with, and then perhaps a custom method to apply those rules instead of the normal ones, such as ".to_plain_formatted"?
on 2008-04-24 17:39
Exactly. See the LaTeX formatter someone added and do likewise.
on 2008-04-24 18:19
Jason Garber wrote: > Exactly. See the LaTeX formatter someone added and do likewise. Coolio - will start working on that. Thanks for your help.
on 2008-05-23 16:59
Cayce, any luck building that plain text formatter? I've got a "base" module that the other formatters build off of, but I'm thinking, "Hey, why not let them build off of a plain text formatter?"
on 2008-05-23 19:56
Excuses, excuses, where's that box of excuses I keep around here somewhere... No, I haven't. The particular client I was working with when I posted the question decided to go with plain text for their email function. The project for me to work on that formatter subsequently got moved to the back-burner behind some higher priority work. I still have aims to do it, because I know it'll be needed in the future - I'll notify on this thread when I get there. Jason Garber wrote: > Cayce, any luck building that plain text formatter? I've got a > "base" module that the other formatters build off of, but I'm > thinking, "Hey, why not let them build off of a plain text formatter?"