logo       

resource_feeder feedback: msg#00202

lang.ruby.rails.core

Subject: resource_feeder feedback


Let me apologize in advance as this is a topic that I feel passionate
and opinionated about. If I'm coming on too strong, please forgive me.

=== Be opinionated===

My first piece of advice is simple: be opinionated. Change the method
name to simply <feed_for>. Have it default to doing the right thing.
Perhaps give an option to change the default feed format, but default to
providing only a single feed format. That's what Microsoft [1],
FeedDemon [2], Bloglines [3] and many others would prefer.

[1] http://blogs.msdn.com/rssteam/archive/2005/08/03/446904.aspx
[2] http://nick.typepad.com/blog/2006/05/pick_a_format_a.html
[3]
http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=cce109de-de25-4852-a8cf-319ccbf0013

If you want, pick RSS 1.0. Or RSS 2.0. Or Atom 1.0. Just pick one.
I'd personally recommend that you be a bit forward thinking, like
Mozilla [4] or the Intelligence community [5]; but if for some reason
you want to pick another format from that list; I won't complain.

[4] http://bugzilla.mozilla.org/show_bug.cgi?id=313441
[5] https://dnidata.org/education/xnotes/RSS_and_Atom_Considerations.xml

=== Summary and Content ===

Independent of feed format, my biggest input is that you think a bit
more about description. It has a number of problems. The first can be
expressed thus: undoubtedly the column in the database from which this
element is often sourced is of some string type; in such cases: what
would a '<' character in such a column mean? Does it signal the start
of markup? Or is it simply a less than character?

My experience is that most string columns in a database are simply plain
text. That also tends to be the 'safe' choice in most cases; treating
markup as plain text will expose the markup. This , while suboptimal,
at least is obvious. In the reverse case, what you have is silent data
loss [6].

[6] http://www.intertwingly.net/blog/2004/05/28/detente

If you want to put plain text in an RSS 1.0 or RSS 2.0 <description>,
and you are using Builder 2.0 (you *are* using Builder 2.0, aren't
you?), then you need to add a .to_xs to escape the string. If you want
to put plain text into an Atom <summary> or <content element>, you need
do nothing as that is the default.

Now you need a convention (possibly as simple as
.downcase.ends_with?("html")) and an a way to override this (perhaps
options[:feed][:content_type]?). If content_type=='html', you want to
omit the call to .to_xs for RSS 1.0 and RSS 2.0. For Atom, simply do

xml.content(:type => options[:feed][:content_type] || ... || 'text')

Next, consider internationalization / character encoding issues.
Builder prefers utf-8; but with Builder 2.0 it will fall back to
iso-8859-1/win-1252. This is the right default for a wide number of
cases, but it will be wrong in a case that you might care about: native
Mac applications.

Finally, consider splitting summary and content. Summary should go into
description in RSS 1.0 and RSS 2.0; but content should go into
content:encoded. This extension enjoys wide support, so it is safe to
use [7]. For Atom, summary and content go into summary and content
respectively. Additionally, with Atom, you can put XML directly into
the content; this may be a reasonable default.

[7] http://www.rssboard.org/rss-profile#namespace-elements-content-encoded

=== Other details ===

You declare xmlns:dc; you really want to use this. Put some author
information into the feed [8]. This goes for all feed versions, though
Atom structures this information differently. Author information can
either be a single author for the entire feed, or an author for each
entry, or both.

[8] http://www.rssboard.org/rss-profile#namespace-elements-dublin-creator

The default feed title probably should include the database name.

You omit channel description if there isn't an options which specify
this value; doing this is only valid in Atom 1.0; with RSS 1.0 and RSS
2.0 channel description is required.

Omitting language if it isn't specified is probably better than
defaulting to en-us.

Re: TTL, before you go there, read [9].

[9] http://www.rssboard.org/rss-profile#element-channel-ttl

Entry/Item titles have much the same problems as descriptions in RSS
2.0, only there isn't nearly as much consensus on how to escape it. In
particular, in generally it isn't possible find a representation that
allows you to express a '<' character in a title. This problem doesn't
exist in Atom 1.0.

Overall on the nomenclature: be consistent. You currently have
options[:feed][:item]. This should either be options[:channel][:item]
(matching RSS) or options[:feed][:entry] (matching Atom).

=== PDI ===

Since PDI is potentially the response that this post deserves, let me
point out that resource_feeder doesn't really require much code to
implement. :-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise