Sha256: a217379ac528437533d26baeb373627c6e69189b405b87928dd1c677875ee7e1

Contents?: true

Size: 500 Bytes

Versions: 11

Compression:

Stored size: 500 Bytes

Contents

module Cms
  class ContentFilter

    # Strips HTML from any attribute that's not :content
    #
    # Handles CKEditor's habit of adding opening/closing <p> tags to everything.
    # @TODO Have this inspect the underlying model to determine the actual attribute.
    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
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 lib/cms/content_filter.rb
browsercms-artirix-4.0.3.3 lib/cms/content_filter.rb
browsercms-artirix-4.0.3.2 lib/cms/content_filter.rb
browsercms-artirix-4.0.3.1 lib/cms/content_filter.rb
browsercms-artirix-4.0.3 lib/cms/content_filter.rb
browsercms-artirix-4.0.2 lib/cms/content_filter.rb
browsercms-artirix-4.0.1.1 lib/cms/content_filter.rb
browsercms-artirix-4.0.0.rc1.art4 lib/cms/content_filter.rb
browsercms-4.0.0.rc1 lib/cms/content_filter.rb
browsercms-4.0.0.beta lib/cms/content_filter.rb
browsercms-4.0.0.alpha lib/cms/content_filter.rb