Sha256: 826ed152b1ca368365a5b2e9566fcfbd15015c43d3397ca05473c428d344729d
Contents?: true
Size: 544 Bytes
Versions: 10
Compression:
Stored size: 544 Bytes
Contents
require 'sanitize' class Govspeak::HtmlSanitizer def initialize(dirty_html) @dirty_html = dirty_html end def sanitize Sanitize.clean(@dirty_html, sanitize_config) end def sanitize_without_images config = sanitize_config config[:elements].delete('img') Sanitize.clean(@dirty_html, config) end def sanitize_config config = Sanitize::Config::RELAXED.dup config[:attributes][:all].push("id", "class") config[:attributes]["a"].push("rel") config[:elements].push("div", "hr") config end end
Version data entries
10 entries across 10 versions & 1 rubygems