Sha256: 42f6f426f4acc16356e884aa8306fdd88ea6a24b3d7ee9e5c46364171f2bf60e

Contents?: true

Size: 402 Bytes

Versions: 6

Compression:

Stored size: 402 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_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

6 entries across 6 versions & 1 rubygems

Version Path
govspeak-1.2.5 lib/govspeak/html_sanitizer.rb
govspeak-1.2.4 lib/govspeak/html_sanitizer.rb
govspeak-1.2.3 lib/govspeak/html_sanitizer.rb
govspeak-1.2.2 lib/govspeak/html_sanitizer.rb
govspeak-1.2.0 lib/govspeak/html_sanitizer.rb
govspeak-1.1.0 lib/govspeak/html_sanitizer.rb