lib/rake/data/dsl.rb
def parse_html( dest, source, &parser )
      require 'nokogiri'
      require 'csv'

      file dest => source do
        puts "Parsing #{source} -> #{dest}"
        mkdir_p dest.to_s.pathmap( "%d" )

        html = Nokogiri.parse( File.read( source ) )
        CSV.open( dest.to_s, "wb" ) do |csv|
          parser.call( html, csv )
        end
      end
    end
# Parse an HTML file into CSV
Parse an HTML file into CSV
Parse an HTML file into CSV
def parse_html( dest, source, &parser )
      require 'nokogiri'
      require 'csv'
      file dest => source do
        puts "Parsing #{source} -> #{dest}"
        mkdir_p dest.to_s.pathmap( "%d" )
        html = Nokogiri.parse( File.read( source ) )
        CSV.open( dest.to_s, "wb" ) do |csv|
          parser.call( html, csv )
        end
      end
    end
def parse_html ( dest , source , & parser ) require 'nokogiri' require 'csv' file dest => source do puts "Parsing #{source} -> #{dest}" mkdir_p dest . to_s . pathmap ( "%d" ) html = Nokogiri . parse ( File . read ( source ) ) CSV . open ( dest . to_s , "wb" ) do | csv | parser . call ( html , csv ) end end end
Parse an HTML file into CSV
Parse an HTML file into CSV
dest
source
parser