Sha256: 85d7c36993a09a101e7d4ed8e0f375952875adf69c104ce0898f57dbc1086af0
Contents?: true
Size: 827 Bytes
Versions: 3
Compression:
Stored size: 827 Bytes
Contents
# frozen_string_literal: true require "selma" class HTMLPipeline class NodeFilter < Filter attr_accessor :context def initialize(context: {}, result: {}) super(context: context, result: {}) send(:after_initialize) if respond_to?(:after_initialize) end # The String representation of the document. def html raise InvalidDocumentException if @html.nil? && @doc.nil? @html || doc.to_html end def reset! result = {} # rubocop:disable Lint/UselessAssignment send(:after_initialize) if respond_to?(:after_initialize) end class << self def call(html, context: {}, result: {}) node_filter = new(context: context, result: result) Selma::Rewriter.new(sanitizer: nil, handlers: [node_filter]).rewrite(html) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
html-pipeline-3.2.2 | lib/html_pipeline/node_filter.rb |
html-pipeline-3.2.1 | lib/html_pipeline/node_filter.rb |
html-pipeline-3.2.0 | lib/html_pipeline/node_filter.rb |