Strip html

say i wanted to allow only certain html characters from my user
submissions, and strip everything else. does rails have a built-in for
this?

matt a écrit :

say i wanted to allow only certain html characters from my user
submissions, and strip everything else. does rails have a built-in for
this?

No, but you should look at RubySoup.

On 3 Mar 2006, at 21:09, matt wrote:

say i wanted to allow only certain html characters from my user
submissions, and strip everything else. does rails have a built-in
for this?

I created a helper for my app that strips all html tags and then re-
links anything that is an http or mailto link using the strip_tags
and auto_link functions

def sanitize_text_but_keep_links (text)
@sanitized_text = strip_tags(text)
@sanitized_text = auto_link(@sanitized_text)
return @sanitized_text
end

David


David S.
w: http://davidsmalley.com/blog