On Dec 16, 2004, at 12:07, Bil Kleb wrote: > The other month we hooked Dave's commit2rss.rb script up > to our CVS repository to gain an RSS feed. (Thanks Dave!) > > Now we'd like to display the RSS feed in a sidebar. What's > the best method to do this? Currently our web person is > using some third-party converter that produces some rather > ugly HTML. My Dr Dobbs article has a trivial program to do exactly that. Here's a variant of it that we use on the PragProg site to create some HTML which is injected into Mike Clark's automation page. It reads his blog's RSS, then uploads a converted file to our website. Cheers Dave # Such down the top 'n' articles from an RSS feed # and summarize for a web site require 'rss/0.9' require 'open-uri' require 'rdoc/template' require 'net/ftp' TEMPLATE = %{ <div class="blogentries"> START:entries <div class="blogentry"> <a href="%link%"><span class="blogentrytitle">%title%</span></a> <div class="blogentrydescription"> %description% </div> </div> END:entries </div> } TMP_FILE = "/tmp/topfive" BLOG_URL = 'http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/synopsis.rss? count=5' open(BLOG_URL) do |http| result = RSS::Parser.parse(http.read, false) entries = result.items.map do |item| { 'title' => item.title, 'link' => item.link, 'description' => item.description } end File.open(TMP_FILE, "w") do |f| t = TemplatePage.new(TEMPLATE) t.write_html_on(f, 'entries' => entries) end end Net::FTP.open('www.yoursite.com') do |ftp| ftp.login('user', 'passwd') ftp.chdir('somedir') ftp.put(TMP_FILE, 'topfive', 1024) end