Class: HTMLPipeline::NodeFilter
- Defined in:
- lib/html_pipeline/node_filter.rb,
lib/html_pipeline/node_filter/emoji_filter.rb,
lib/html_pipeline/node_filter/https_filter.rb,
lib/html_pipeline/node_filter/mention_filter.rb,
lib/html_pipeline/node_filter/asset_proxy_filter.rb,
lib/html_pipeline/node_filter/team_mention_filter.rb,
lib/html_pipeline/node_filter/absolute_source_filter.rb,
lib/html_pipeline/node_filter/image_max_width_filter.rb,
lib/html_pipeline/node_filter/syntax_highlight_filter.rb,
lib/html_pipeline/node_filter/table_of_contents_filter.rb
Direct Known Subclasses
AbsoluteSourceFilter, AssetProxyFilter, EmojiFilter, HttpsFilter, ImageMaxWidthFilter, MentionFilter, SyntaxHighlightFilter, TableOfContentsFilter, TeamMentionFilter
Defined Under Namespace
Classes: AbsoluteSourceFilter, AssetProxyFilter, EmojiFilter, HttpsFilter, ImageMaxWidthFilter, MentionFilter, SyntaxHighlightFilter, TableOfContentsFilter, TeamMentionFilter
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
Attributes inherited from Filter
Class Method Summary collapse
Instance Method Summary collapse
-
#html ⇒ Object
The String representation of the document.
-
#initialize(context: {}, result: {}) ⇒ NodeFilter
constructor
A new instance of NodeFilter.
- #reset! ⇒ Object
Methods inherited from Filter
#base_url, #call, #has_ancestor?, #needs, #validate
Constructor Details
#initialize(context: {}, result: {}) ⇒ NodeFilter
Returns a new instance of NodeFilter.
9 10 11 12 |
# File 'lib/html_pipeline/node_filter.rb', line 9 def initialize(context: {}, result: {}) super(context: context, result: {}) send(:after_initialize) if respond_to?(:after_initialize) end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/html_pipeline/node_filter.rb', line 7 def context @context end |
Class Method Details
.call(html, context: {}, result: {}) ⇒ Object
27 28 29 30 |
# File 'lib/html_pipeline/node_filter.rb', line 27 def call(html, context: {}, result: {}) node_filter = new(context: context, result: result) Selma::Rewriter.new(sanitizer: nil, handlers: [node_filter]).rewrite(html) end |
Instance Method Details
#html ⇒ Object
The String representation of the document.
15 16 17 18 19 |
# File 'lib/html_pipeline/node_filter.rb', line 15 def html raise InvalidDocumentException if @html.nil? && @doc.nil? @html || doc.to_html end |
#reset! ⇒ Object
21 22 23 24 |
# File 'lib/html_pipeline/node_filter.rb', line 21 def reset! result = {} # rubocop:disable Lint/UselessAssignment send(:after_initialize) if respond_to?(:after_initialize) end |