#!/usr/bin/env ruby
require 'csv'

data = CSV.read("template.csv", headers:true)
template = File.read("template.html")
data.each do |row|
  file = sprintf("output-%s.html", row["_id_"])
  tango = row
  open(file, "w") {|html| html.print template.gsub(/_[A-Z]+_/i, tango)}
end
