Skip to content

Instantly share code, notes, and snippets.

@yoko
Created November 18, 2010 03:44
Show Gist options
  • Save yoko/704597 to your computer and use it in GitHub Desktop.
Save yoko/704597 to your computer and use it in GitHub Desktop.
#!ruby -Ku
require 'csv'
tr = []
CSV.open(ARGV[0], 'r') do |row|
td = []
row.each do |i|
if i
td.push("<td id=\"#{i}\" class=\"border\">#{i.sub(/\D+/, '')}</td>\n")
else
td.push("<td></td>\n")
end
end
td.join('')
tr.push("<tr>\n#{td}</tr>\n")
end
tr = tr.join('')
table = "<table><tbody>\n#{tr}</tbody></table>"
puts table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment