[uf-rest] Ruby/Rails helper for Microformats?

Mark Rickerby maetl at mcs.vuw.ac.nz
Thu Aug 31 21:17:35 PDT 2006


On 9/1/06, Dr. Ernie Prabhakar <drernie at opendarwin.org> wrote:
> I'm still trying to figure out
> what kind of experiments are worth doing...
>
> The one thing I've been wondering about is whether there should be an
> easier/more automatic way of adding class names to HTML.

Not sure if this is off topic, but I was wondering whether it might be
useful to flip this around and look at things from the opposite
perspective of treating xhtml pages as remote data sources.

This is where Rails could potentially provide one hell of a jump start
for building distributed apps and microformats mashups.

Sketch...

Entry = MicroformatResource.new do |m|
    m.uri = "http://microformats.org/"
    m.schema = :hentry
end

entry = Entry.find_by_title("Steve Martin has an hCard")
entry.bookmark # >
http://microformats.org/blog/2006/07/28/steve-martin-has-an-hcard/

Note, that if the schema symbol in this example was delegating to a
parser strategy (what's a better way to do this?), there would have to
be some kind of dependency chain that implicitly allowed for multiple
embedded microformats...

eg: :hentry => :hcard

In the hAtom case, the .author field must return an embedded struct of
hCard properties, or something similar (analogous to the
has_one/belongs_to relationship):

from the above example:

entry.author.fn # > Ryan
entry.author.url # > http://theryanking.com

Admittedly, this somewhat simple example raises a lot of weird
classname=>property mapping issues (eg: is it Entry.find_by_title or
Entry.find_by_entry_title)...

Thoughts? Anyone keen to dive in and get this working? I haven't
looked at the source code for ActiveResource yet, but I'm sure it's
possible to figure out a much better design for doing pretty much what
I just described.

Cheers,
Mark


More information about the microformats-rest mailing list