Hello everyone, I was reading through the Rails API and came across Text::Format. It appears as if I can use this to format my text for my users. I''ll be launching a creative writing website and if I can allow members text formatting to remain the same as it would be in a word processor, that would really be beneficial. I''m not looking for a WYSIWYG editor - I just want the tabs to be preserved from a cut and paste. Unfortunately, I cannot find any type of help on this class. I''m fairly new with Ruby on Rails, though can follow tutorials like no other. If you know of a tutorial that utilizes this class, that would be most helpful. Otherwise, some usage examples would be very much appreciated. Thanks for your time and help! ~Dustin Tigner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
*Nudge* Not to be obnoxious, though any help would be appreciated. A mere point in the right direction would be appreciated. Thanks! ~Dustin Tigner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dustin Tigner wrote:> if I can allow members text > formatting to remain the same as it would be in a word processor, that > would really be beneficial. I''m not looking for a WYSIWYG editor - I > just want the tabs to be preserved from a cut and paste.You might want to look into RedCloth and BlueCloth. They are Ruby libraries that provide support for Textile and Markdown, markup notations that are simpler than HTML. If you''re familiar with editing Wikipedia pages, it''s kind of like that. Preserving tabs might be a bit tricky though. I don''t know how you''d render them in HTML -- maybe a series of ? -- 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 -~----------~----~----~----~------~----~------~--~---
Thanks Jeremy, I have looked into RedCloth and BlueCloth before. Unfortunately, these gems / plugins add ''too'' much functionality. The Text::Format class looks like to does exactly what I want it to do, I just don''t know how to use it. Here is a link to the Rails API: http://www.railsbrain.com/api/rails-2.1.0/doc/index.html?a=C00000543&name=Text::Format As for tabs, I''m assuming the object adds s, just as you said. Anyway, thanks for the reply! Any further help would be much appreciated. Thanks! ~Dustin Tigner On Jul 24, 6:11 pm, Jeremy Weiskotten <rails-mailing-l...@andreas- s.net> wrote:> Dustin Tigner wrote: > > if I can allow members text > > formatting to remain the same as it would be in a word processor, that > > would really be beneficial. I''m not looking for a WYSIWYG editor - I > > just want the tabs to be preserved from a cut and paste. > > You might want to look into RedCloth and BlueCloth. They are Ruby > libraries that provide support for Textile and Markdown, markup > notations that are simpler than HTML. If you''re familiar with editing > Wikipedia pages, it''s kind of like that. > > Preserving tabs might be a bit tricky though. I don''t know how you''d > render them in HTML -- maybe a series of ? > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I believe I''ve found a solution to my problem. A PHP programmer thought it was odd that RoR didn''t have a \n to <br /> converter, such as the nl2br method. Thus, he wrote a helper method: def nl2br(s) s.gsub(/\n/, ''<br />'' + "\n") end I took this code and changed it out with a \t and created: def tabber(s) s.gsub(/\t/, '' '') end This, in combination with simple_format, does everything I want. An example of the usage: <%= tabber simple_format "Here is my text" %> Hope that helps someone. Thanks for your help! ~Dustin Tigner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---