Sha256: eef12f8fcf525c820bba1b08e9e5282fd225465a9b8e7bdbb485028bb5892d66

Contents?: true

Size: 461 Bytes

Versions: 3

Compression:

Stored size: 461 Bytes

Contents

# encoding: utf-8

class Sanitize; module Transformers

  CleanDoctype = lambda do |env|
    return if env[:is_allowlisted]

    node = env[:node]

    if node.type == Nokogiri::XML::Node::DTD_NODE
      if env[:config][:allow_doctype]
        if node.name != "html"
          document = node.document
          node.unlink
          document.create_internal_subset("html", nil, nil)
        end
      else
        node.unlink
      end
    end
  end

end; end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sanitize-6.1.3 lib/sanitize/transformers/clean_doctype.rb
sanitize-6.1.2 lib/sanitize/transformers/clean_doctype.rb
sanitize-6.1.1 lib/sanitize/transformers/clean_doctype.rb