#!ruby -w # Structured Dashes to Chouser's Blog HTML require 'sd' # get previous version number # If the serial number is to remain completely invisible, perhaps a random # number would work better. vfile = 'blogv.xml' vnum = File.open(vfile) { |file| file.read() =~ %r((\d+)); $1.to_i; } vnum += 1; puts "vnum: #{vnum}" File.open(vfile, 'w') { |file| file.puts "#{vnum}" } doc = sdparse( ARGV[0] ) File.open('index.html', 'w') { |file| file.puts %Q( #{lastposttime doc, '%a %d'}: #{doc['title']}
Chouser's Home

#{doc['title']}

Terrorism Alert Level

Table of Contents

    #{doc.all('item').map { |item| next unless item['pubDate']; %Q{
  • #{item['title']}
  • }}}

Formats of this page

#{doc.all('item').map { |item| next unless item['pubDate']; %Q{

#{item['title']}

#{ time = gettime(item['pubDate']) time ? time.strftime('%a %d %b %Y') : item['pubDate'] }
#{ to_html item.get_one('description') }
}}}
) }