Class: Banzai::Filter::SuggestionFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Banzai::Filter::SuggestionFilter
- Defined in:
- lib/banzai/filter/suggestion_filter.rb
Constant Summary collapse
- TAG_CLASS =
Class used for tagging elements that should be rendered
'js-render-suggestion'
- CSS =
'pre.language-suggestion > code'
- XPATH =
Gitlab::Utils::Nokogiri.css_to_xpath(CSS).freeze
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/banzai/filter/suggestion_filter.rb', line 13 def call return doc unless suggestions_filter_enabled? doc.xpath(XPATH).each do |node| node.add_class(TAG_CLASS) end doc end |
#suggestions_filter_enabled? ⇒ Boolean
23 24 25 |
# File 'lib/banzai/filter/suggestion_filter.rb', line 23 def suggestions_filter_enabled? context[:suggestions_filter_enabled] end |