#!ruby -w # Structured Dashes to RSS require 'sd' doc = sdparse( ARGV[0] ) # If descriptions contained real xhtml tags, instead of CDATA, these might # be useful: # # puts %Q( ); doc.each do |key, val| next if key == 'item' puts " <#{key}>#{val.strip}" end puts doc.all('item').each do |item| next unless item['pubDate'] puts "\n "; item.each do |key, val| next if key == 'style' if key == 'description' val = "" val += "\n "; elsif key == 'pubDate' # Wed, 02 Oct 2002 13:00:00 GMT time = gettime(val) val = time ? time.strftime('%a, %d %b %Y %H:%M:%S %Z') : val end if key == 'id' link = doc['link'] + '#' + val.strip puts " #{link}" puts " " puts " #{link}" puts " " else puts " <#{key}>#{val.strip}" end end puts " " end puts %q( );