Sha256: 00073b6180f93de8a8022f78c3317cb5ca2b3f7f9b744f29d05f0f4576c2e3b8

Contents?: true

Size: 692 Bytes

Versions: 8

Compression:

Stored size: 692 Bytes

Contents

require 'sanitize'

module Html2rss
  module AttributePostProcessors
    class SanitizeHtml
      def initialize(value, _options, _item)
        @value = value
      end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
html2rss-0.3.3 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.3.2 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.3.1 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.3.0 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.2.2 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.2.1 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.2.0 lib/html2rss/attribute_post_processors/sanitize_html.rb
html2rss-0.1.0 lib/html2rss/attribute_post_processors/sanitize_html.rb