Sha256: 2ed3e93f35bd9627afdd5fac33a89560c8f32e0e35ab524ec2c2a6ae8d977fd5

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

class MailToAwesome < ::HTMLProofer::Check
  def mailto?
    return false if @link.ignore? || @link.href.nil?
    @link.href.match /^mailto:/i
  end

  def awesome?
    @link.href.downcase.include? 'subject=' and @link.href.downcase.include? 'body='
  end

  def run
    return unless @options[:check_mailto_awesome]
    @html.css('a').each do |node|
      @link = create_element(node)
      line = node.line
      content = node.to_s

      if mailto? && !awesome?
        add_issue("This is a not-awesome mailto link!", line: line, content: content)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
html-proofer-mailto_awesome-1.0.0 lib/mail_to_awesome.rb
html-proofer-mailto_awesome-0.1.3 lib/mail_to_awesome.rb