Class: Cms::ContentFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/cms/content_filter.rb

Instance Method Summary collapse

Instance Method Details

#filter(content) ⇒ Object

Strips HTML from any attribute that’s not :content

Handles CKEditor’s habit of adding opening/closing <p> tags to everything.



8
9
10
11
12
13
14
15
16
# File 'lib/cms/content_filter.rb', line 8

def filter(content)
  c = content.clone
  c.keys.each do |key|
    if(key != :content && key != "content")
      c[key] = HTML::FullSanitizer.new.sanitize(c[key]).strip
    end
  end
  c
end