Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Hof authored and courts committed Apr 28, 2011
0 parents commit 53a2a76
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions rem2jorte.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env ruby

require 'csv'

require 'polyglot'
require 'treetop'
require 'remparser'

#CSV.read('test/schedule_data.csv')

parser = RemindParser.new

csv_string = CSV.generate(options={:headers => true}) do |csv|
csv << ["schedule_date", "start_time", "end_date", "end_time", "title", "content", "place", "importance", "status", "meridiem"]
$stdin.each do |line|
rem = parser.parse(line)
res = rem.content_hash
row = []
row << res[:date].strftime("%Y/%m/%d")
if res[:body].has_key? :time
row << res[:body][:time][:start]
else
row << nil
end
row << res[:date].strftime("%Y/%m/%d")
if res[:body].has_key? :time
row << res[:body][:time][:end]
else
row << nil
end
row << res[:body][:text]
2.times {row << nil}
3.times {row << 0}
csv << row
end
end

puts csv_string

0 comments on commit 53a2a76

Please sign in to comment.