Sha256: 19368112d02c25b7c557ff0f46a5ed4db48765a55f875063bc08e6df837f5605
Contents?: true
Size: 770 Bytes
Versions: 4
Compression:
Stored size: 770 Bytes
Contents
require 'sanitize' module Mumukit::ContentType::Sanitizer class << self class_attribute :should_sanitize, :allowed_elements, :allowed_attributes self.should_sanitize = false self.allowed_elements = [] self.allowed_attributes = { 'a' => Sanitize::Config::RELAXED[:attributes]['a'] + ['target'] } def sanitize(html) return html unless should_sanitize? Sanitize.fragment(html, sanitization_settings) end def sanitization_settings Sanitize::Config.merge(Sanitize::Config::RELAXED, custom_sanitization_settings) end def custom_sanitization_settings { elements: Sanitize::Config::RELAXED[:elements] + allowed_elements, attributes: allowed_attributes } end end end
Version data entries
4 entries across 4 versions & 1 rubygems