1) Is there a way to strip a redcloth string of all redcloth tags? I need to display a snippet of the text in an index page and want all markings removed. I used RedCloth.new(''a'').methods but didn''t find anything appropriate. For now, I''m converting to html then stripping tags. 2) what''s the best practice in term of storing user''s redcloth- formatted text? store in markup, and convert to html on the fly? store in markup and html both? store in html and convert to markup using clothred for editing? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
1) I don''t know for sure, but I don''t think there is. 2) I store the text as the user typed in the database and then use RedCloth to textilize it when rendering. It uses more CPU ticks but at least that way I have the original comment stored. If a user wanted to edit his or her comment I wouldn''t have to try something sloppy like converting HTML back to markup but rather show them what they entered to begin with. You can possibly store both the textilized text and the original text for good measure (in case it needs to be parsed again later on for whatever reason). I personally don''t do that because I do a lot of modifications to the text in my helpers before and after it''s been converted to HTML. rubynuby wrote:> 1) Is there a way to strip a redcloth string of all redcloth tags? I > need to display a snippet of the text in an index page and want all > markings removed. I used RedCloth.new(''a'').methods but didn''t find > anything appropriate. For now, I''m converting to html then stripping > tags. > > 2) what''s the best practice in term of storing user''s redcloth- > formatted text? store in markup, and convert to html on the fly? > store in markup and html both? store in html and convert to markup > using clothred for editing?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I add another column to my table paralleling the original column, (i.e. body, filtered_body), and then use the before_save activerecord callback to convert the textile content to html, and store the result in filtered_body for display. That way it gets updated whenever you make a change, but you aren''t doing it on every page load... --matt On 12/5/07, R. Elliott Mason <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 1) I don''t know for sure, but I don''t think there is. > > 2) I store the text as the user typed in the database and then use > RedCloth to textilize it when rendering. It uses more CPU ticks but at > least that way I have the original comment stored. If a user wanted to > edit his or her comment I wouldn''t have to try something sloppy like > converting HTML back to markup but rather show them what they entered to > begin with. You can possibly store both the textilized text and the > original text for good measure (in case it needs to be parsed again > later on for whatever reason). I personally don''t do that because I do > a lot of modifications to the text in my helpers before and after it''s > been converted to HTML. > > rubynuby wrote: > > 1) Is there a way to strip a redcloth string of all redcloth tags? I > > need to display a snippet of the text in an index page and want all > > markings removed. I used RedCloth.new(''a'').methods but didn''t find > > anything appropriate. For now, I''m converting to html then stripping > > tags. > > > > 2) what''s the best practice in term of storing user''s redcloth- > > formatted text? store in markup, and convert to html on the fly? > > store in markup and html both? store in html and convert to markup > > using clothred for editing? > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Matt White ----------------------- Thermal Creative http://blog.thermalcreative.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---