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

Andrew Turner ajturner at highearthorbit.com
Fri Sep 1 06:10:43 PDT 2006


Ernie Prabhakar" wrote:
> > But in summary: Get a plugin going for this. That's how the new
> > REST support got its start (Simply Restful).
>
> Thanks for the advice.  So, what should such a plug-in do?  Define
> method names for common microformat elements, so that they can be
> invoked from rhtml files? Like (I presume) Assaf is doing:
>
> http://blog.labnotes.org/2006/08/25/microformats-helper-for-ruby-on-
> rails/
>

I've worked on this a bunch. I took Assaf's scrAPI and made a more
generic uf parser:
http://highearthorbit.com/microformat-ruby-parser/

One idea we came up with would be to have the Microformat base class
consume a formatting file to dynamically build the Location, Address,
etc. sub-classes. This way the classes are built based on an easy to
maintain file, rather than having to maintain actual classes.

Second, I started a RubyForge project,
http://rubyforge.org/projects/mfwrite. I haven't had a chance to
'release' anything yet, as I'm still figuring out what works best.

Internally, I'm using helpers with generic interfaces that I pass a
hash to for, say, Person, and it returns uf xhtml. What I'm trying to
determine is what is the best means to pass in desired formatting to
the helper. Would it be a block or partial that is then filled in? Or
a plugin that can install partials to your app/ directory and then you
can clean them up.

I agree with David on making a plugin. But also following
Rails/Pragmatic design, which follows very closely with uf ideals,
extract it from actual usage rather than design some arbitrary
solution.

Andrew

-- 
Andrew Turner
http://highearthorbit.com


More information about the microformats-rest mailing list