Sha256: 4cc0e6f6d4b68c233500762da93113ec2d7669fb2d9bd3d00253b25facdfd276
Contents?: true
Size: 937 Bytes
Versions: 1
Compression:
Stored size: 937 Bytes
Contents
class Slacken::DocumentComponent module SanitizeLinkContainers # Private: Sanitize not allowed tags in links. def sanitize_link_containers case type.name when :img, :a, :iframe derive(children.map(&:sanitize_in_link)) else derive(children.map(&:sanitize_link_containers)) end end def sanitize_in_link if type.allowed_in_link? derive(children.map(&:sanitize_in_link)) else # No block tags are allowed. derive(children.map(&:sanitize_in_link), type: :span) end end def link_sanitized? case type.name when :img, :a, :iframe children.all?(&:list_containers_sanitized?) else children.all?(&:link_sanitized?) end end def link_container_sanitized? if type.allowed_in_link? children.all?(&:link_containers_sanitized?) else false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slacken-0.1.0 | lib/slacken/document_component/sanitize_link_containers.rb |