#! /usr/bin/ruby
# Create an HTML string from the current .OPML feedlist.
# This will appear on the RubyRiver navbar.
def gen_feedlist
# Read the .opml file into memory for XML parsing.
opmlfile = File.open(get_param("rubyriver.yml","feedlist"))
opmldoc = Document.new(opmlfile.read)
opmlfile.close
# Add the details for each feed to a single string.
feedstr = ""
opmldoc.elements.each("opml/body/outline/outline") do |item|
feedstr += '<a href="' + item.attributes["htmlUrl"] + '">' +
item.attributes["title"] + '</a> (' + '<a href="' +
item.attributes["xmlUrl"] + '">feed</a>)<br>'
end
return feedstr
end