News headline (RSS summary) behavior

I’ve just finished a first version of a simple news headline tag for
Radiant, incorporated into a ‘News’ behavior. It parses an RSS feed from
a given feed URL and generates an unordered list of headline items. The
number of headlines and whether or not a published date gets appended
can be configured through attributes. The behavior has been tested with
the main article XML feed from a Typo 2.6.0 blog, an RForum 0.2 all
forums post feed and a Collaboa 0.5.6 installation’s ticket feed.

http://pond.org.uk/ruby/

Example:

<r:news feed = “http://mydomain.org/articles.xml
headlines = “3”
dates = “1” />

Leads to something like:

  • First news item (01-Aug-2006)
  • Next headline (28-Jul-2006)
  • Final RSS item title (19-Jul-2006)

The code requires the simple-rss gem. Unfortunately this does not work
with SlashDot’s news feed - the RSS parser doesn’t seem to understand
it. RSS issues aside, it may have been better to have created tags that
expressed the RSS contents directly and so provide greater content
flexibility, though this would increase complexity for the user
considerably. The existing behavior meets my immediate requirements, but
if I find some spare time I may look into making a more generic RSS
behavior too.

Andrew H. wrote:

The code requires the simple-rss gem. Unfortunately this does not work
with SlashDot’s news feed […]

Updated to use the core RSS parser, so the gem is no longer required.
Problem with SlashDot fixed - tags are expanded before filters run; “~”
characters in SlashDot URLs were being expanded into “”, breaking
the HTML. Since there doesn’t seem to be a way to escape text to avoid
Textile or Markdown processing, the “~” character is treated as a
special case in links and expanded to “%7E” instead.

Same location as before:

http://pond.org.uk/ruby

Yesterday, I wrote:

[…] it may have been better to have created tags that
expressed the RSS contents directly and so provide greater content
flexibility, though this would increase complexity […]

Someone else already wrote one. The threading got broken on the RForum
interface so the two parts of the same discussion are separate there -
see the following for details:

http://www.ruby-forum.com/topic/76241