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

N

Nicholas Wieland

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
 
N

Nicholas Wieland

Il giorno 30/dic/08, alle ore 04:04, (e-mail address removed) ha scritto:
Do you want to output microformats, or parse them?

Output, as the file I linked very clearly does.

ngw
 
N

Nicholas Wieland

Il giorno 30/dic/08, alle ore 16:09, (e-mail address removed) ha scritto:
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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top