Created
May 19, 2014 09:06
-
-
Save syohex/136e1b965bab98db3620 to your computer and use it in GitHub Desktop.
Script for updating auto-complete CSS dictionary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'nokogiri' | |
require 'set' | |
old_url = 'https://raw.githubusercontent.com/auto-complete/auto-complete/master/dict/css-mode' | |
old_properties = SortedSet.new | |
open(old_url).read.each_line do |line| | |
old_properties.add(line.strip) | |
end | |
doc = Nokogiri::parse(open('http://www.w3schools.com/cssref/default.asp')) | |
new_properties = SortedSet.new | |
doc.css('table.reference > tr').each do |e| | |
td = e.css('td') | |
next if td.nil? | |
next if td.first.nil? | |
property = td.first.text | |
property.strip! | |
new_properties.add(property) | |
end | |
merged = old_properties | new_properties | |
merged.each do |property| | |
puts property | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment