mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
17 lines
372 B
Ruby
17 lines
372 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ContentScrubber < Rails::Html::PermitScrubber
|
|
ALLOWED_TAGS = ["p", "b", "strong", "em", "i", "a", "u", "img"].freeze
|
|
ALLOWED_ATTRIBUTES = ["href", "target", "src", "alt"].freeze
|
|
|
|
def initialize
|
|
super
|
|
self.tags = ALLOWED_TAGS
|
|
self.attributes = ALLOWED_ATTRIBUTES
|
|
end
|
|
|
|
def skip_node?(node)
|
|
node.text?
|
|
end
|
|
end
|