Redcloth ignore YouTube embeds?

Hi folks.

I’m trying to process blog posts using RedCloth, stripping any html
entered by the user, but leaving , and tags
untouched.

So far I’ve tried…

========================

require ‘rubygems’
require ‘redcloth’

t = 'I am a badger

t = t.gsub( /(<object(.|\n)+?</object>)/ ,
“#{$1}”)

r = RedCloth.new(t, [:filter_html])
p r.to_html

========================

=> "

I am a badger

"

But the object tags are still stripped, as the filter_html ignores the
notextlie tags.

Has anyone done similar to this before, or know how I can add tags to
the ignore list?

Thanks in advance.

Just noticed the Gsub is wrong, it should be:

t = t.gsub( /(<object(.|\n)+?</object>)/ ,
“\1”)

Still not problem solved though.

You could use that regexp to pull out the object/embed tags into a
temporary variable, put in a temporary key word, then replace the key
word with the object/embed data after generating the RedCloth HTML.

May not be exactly what you want, but it’ll work.