require 'date' class Entry def initialize number, title, date, date_string, abstract @number=number @date=date @title=title end def number @number end def title @title end def date @date end def date_string @date_string end def <=> b @date <=> b.date end def abstract @abstract end end entries=[] ARGV.each do |meta_file_name| meta={} File.read(meta_file_name).each_line do |line| line.chomp.match /^([^:]+): *(.*?) *$/ meta[$1]=$2 end date = Date.parse(meta['Date'].sub(/Updated */i,'')) entries << Entry.new(meta['Number'], meta['Title'], date, meta['Date'], meta['Abstract']) end entries.sort.each {|entry| puts html here }