Sha256: 87dd3f2c0b1f99576cb7c2c4c3f6d1b6d8aa361f0eb77b44b9cf6ffd6cc54fe1
Contents?: true
Size: 604 Bytes
Versions: 1
Compression:
Stored size: 604 Bytes
Contents
class Slacken::DocumentComponent module ElimInvalidLinks # Private: Eliminate internal links and blank links def elim_invalid_links if invalid_link? derive(children.map(&:elim_invalid_links), type: :span) else derive(children.map(&:elim_invalid_links)) end end def invalid_link? if type.member_of?(:a) link = attrs[:href] link.nil? || !link.match(%r{\Ahttps?://}) else false end end def has_no_invalid_links? !invalid_link? && children.all?(&:has_no_invalid_links?) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slacken-0.1.0 | lib/slacken/document_component/elim_invalid_links.rb |