[uf-discuss] Tentative proposal: Sub-microformats to streamline
common microformat patterns for simple data
Andy Mabbett
andy at pigsonthewing.org.uk
Thu Jan 3 09:00:08 PST 2008
One of the microformat principles is (while not expressed in so many
words) that we should make life easier for publishers, and load work
onto parsers, instead.
There are a great many pages where a vCard is, or could be applied to a
single data-value (such as a name) in prose, or a table, without further
attributes being present; for example:
...as John Smith said...
Currently, that would require:
as <span class="vcard"><span class="fn">John Smith</span></span>
said
which is a considerable amount of mark-up, compared to the actual data,
and significantly bloats a page on which many such name appear.
Other examples might be:
...lived in Birmingham since 2005...
...developed by Acme Inc. using cheese...
It has previously been proposed that:
as <span class="vcard fn">John Smith</span> said
be allowed, but that has been rejected; not least because it might break
existing microformats.
We could simply declare, in the manner of implied-n-optimisation, that
an hCard with no children:
as <span class="vcard">John Smith</span> said
defaults to the equivalent of the full mark-up as used above. Still,
this again might break existing hCards, and could only apply in one case
(for an implied "fn", in this example), so must be rejected.
What we could do, though is create a LIMITED NUMBER of sub-microformats
(effectively, new microformats based on exiting microformats; I'd call
them "nanoformats", if that name was not already taken), using the name
and an attribute from one of those exiting microformats as the new
sub-microformat name.
We would have to be certain that these were limited to cases where vast
numbers of the relevant data items are published, and where the parsing
rules are unambiguous.
Such parsing rules might be:
* <span class="vcard-fn">John Smith</span>
(treat content as fn within vCard; apply n-optimisation if
appropriate)
* <a class="vcard-fn" href="example.com">John Smith</a>
(treat content as fn within vCard; apply n-optimisation if
appropriate, use URL)
* <a class="vcard-fn" href="mailto:john at example.com">
John Smith</a>
(treat content as fn within vCard; apply n-optimisation if
appropriate, use e-mail address)
Further examples might be for organisations:
* <span class="vcard-org">Acme Inc.</span>
(vcard; with fn, and org, both set to "Acme Inc."; also used
with href as above)
and for places:
* <span class="vcard-locality">Birmingham</span>
(vcard; with fn, and adr's locality, both set to "Birmingham")
* <span class="vcard-region">Texas</span>
(vcard; with fn, and adr's region, both set to "Texas")
[In each of the above pair, "vcard-" could be replaced with "adr-" and
parsed accordingly.]
Note again that I am NOT suggesting that all microformat attributes be
combinable in this manner; only a select few, which are deemed necessary
and agreed by consensus (perhaps only those shown above, plus a few
other adr-children; though the pattern could also apply to other,
upcoming microformats).
Benefits of using a single, unambiguously-named, class on a singe
element for simple, single-value data types will include ease of use for
publishers; and more widespread usage of semantic mark-up.
--
Andy Mabbett
More information about the microformats-discuss
mailing list