What you do when dealing with a huge number of conditions?

Damn, don't know what happened ... Is it because the mail is signed by thawte ?

This was my post

Hi *,
  I need to deal with microformats, I would like to write a lib that covers the most common.
As the microformat idea is useful and well thought, as the implementation can become a truckload of crap, a microformat changes when different data is submitted, and can have countless variations.
For hcard I found a rails plugin, and as I thought it's basically a set of if/else conditions dealing with different combinations. You can take a peek here:http://rubyurl.com/ARJR
To add mess to the mess, it's not just a matter of data representation, data is "interlocked", for example there's a rule to optimize the fn element (the name representation, not implemented on microformats_helper): if given-name is == to the organization name, probably it's a nickname, so it should be represented with <whatever class="fn nickname"> ngw </whatever>.
I would like to have some suggestion how to make it without writing too much spaghetti (even if I'm italian :p).

Thoughts ?
  ngw

I need to deal with microformats, I would like to write a lib that
covers the most common.

Do you want to output microformats, or parse them?

For parsing, I reccomend Hpricot.

microformats_helper): if given-name is == to the organization name,
probably it's a nickname, so it should be represented with <whatever
class="fn nickname"> ngw </whatever>.
I would like to have some suggestion how to make it without writing
too much spaghetti (even if I'm italian :p).

Ah, yes, it seems that you want to parse. Use Hpricot, and then do as
much massaging of the result as you need.

If you just want a simple microformats parser, mofo is a good start.

···

--
Stephen Paul Weber, @singpolyma
Please see <http://singpolyma.net> for how I prefer to be contacted.
Don't toppost! <http://www.caliburn.nl/topposting.html&gt;

Output, as the file I linked very clearly does.

   ngw

···

Il giorno 30/dic/08, alle ore 04:04, usenet@singpolyma.net ha scritto:

I need to deal with microformats, I would like to write a lib that
covers the most common.

Do you want to output microformats, or parse them?

I need to deal with microformats, I would like to write a lib that
covers the most common.

Do you want to output microformats, or parse them?

Output, as the file I linked very clearly does.

Well, in that case, there's no real need for a library at all...
microformats are just a good use of the (X)HTML markup you already
have... just add attributes to the right parts of your template.

fn optimization, etc, are there specifically to make this sort of thing
eaiser and more intuitive. Not something you should have to worry
about.

···

--
Stephen Paul Weber, @singpolyma
Please see <http://singpolyma.net> for how I prefer to be contacted.
Don't toppost! <http://www.caliburn.nl/topposting.html&gt;

Well, not really.
Most of optimizations are made at the markup side, this basically means that when you know your data, you can spare some markup and add readability by applying these markup optimizations.
Unfortunately, just for the nickname optimization, code looks something like that:

if organization == given-name && !url
   <span class="fn nickname"> given-name </span>
elsif organization == given-name && url
   <a href="url" class="fn nickname"> given-name </a>
end

Before this, all the cases when the given-name is the same of organization, but there's a family-name.
I'm trying something right now, for most simple cases (rel-licence, rel-tag).

   ngw

···

Il giorno 30/dic/08, alle ore 16:09, usenet@singpolyma.net ha scritto:

I need to deal with microformats, I would like to write a lib that
covers the most common.

Do you want to output microformats, or parse them?

Output, as the file I linked very clearly does.

Well, in that case, there's no real need for a library at all...
microformats are just a good use of the (X)HTML markup you already
have... just add attributes to the right parts of your template.

fn optimization, etc, are there specifically to make this sort of thing
eaiser and more intuitive. Not something you should have to worry
about.

--