Class: Html2rss::AttributePostProcessors::SanitizeHtml

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/attribute_post_processors/sanitize_html.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, _options, _item) ⇒ SanitizeHtml

Returns a new instance of SanitizeHtml.



6
7
8
# File 'lib/html2rss/attribute_post_processors/sanitize_html.rb', line 6

def initialize(value, _options, _item)
  @value = value
end

Instance Method Details

#getObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/html2rss/attribute_post_processors/sanitize_html.rb', line 10

def get
  Sanitize.fragment(@value, Sanitize::Config.merge(
                              Sanitize::Config::RELAXED,
                              add_attributes: {
                                'a' => {
                                  'rel' => 'nofollow noopener noreferrer',
                                  'target' => '_blank'
                                }
                              }
                            ))
end