Skip to content

Instantly share code, notes, and snippets.

@brianjriddle
Created April 25, 2012 13:16
Show Gist options
  • Save brianjriddle/2489624 to your computer and use it in GitHub Desktop.
Save brianjriddle/2489624 to your computer and use it in GitHub Desktop.
checks if a page is missing alt attribute on img tags
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open(ARGV[0]))
doc.xpath('//img').each do |img|
puts img if img["alt"].nil?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment