I want my users to be able to insert links in their profile, but obviously they can''t use html. I want to solve this by allowing them to do [link="http://theirurl.com"][/link]. Any idea how I would go about this? Thanks! -- 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 would consider using Textile or Markdown. Take a look at the RedCloth gem. http://whytheluckystiff.net/ruby/redcloth/ -Dan Manges http://www.dcmanges.com/blog On Sep 22, 11:12 pm, Kyle Murphy <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I want my users to be able to insert links in their profile, but > obviously they can''t use html. > > I want to solve this by allowing them to do > [link="http://theirurl.com"][/link]. Any idea how I would go about > this? > > Thanks! > -- > 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 -~----------~----~----~----~------~----~------~--~---
linker = Regexp.new(/\[link="(.*?)"](.*?)\[\/link]/) <%= @user.profile.gsub(linker){|m| "<a href=''#{m[0]}'' class=''whatever''>#{m[1]}</a>"} %> On Sep 23, 12:12 am, Kyle Murphy <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I want my users to be able to insert links in their profile, but > obviously they can''t use html. > > I want to solve this by allowing them to do > [link="http://theirurl.com"][/link]. Any idea how I would go about > this? > > Thanks! > -- > 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 -~----------~----~----~----~------~----~------~--~---