All in the <head> – Ponderings and code by Drew McLellan –

Microformats Tools and Upcoming Events

I’ve a veritable potpourri of microformat-related things that I need to mention, so I might as well just blurt them out in one go. Prepare yourselves.

New Tools

About six weeks ago, I quietly launched as a home for a number of service-based microformats tools. There’s a live hKit service, an implementation of the hAtom2Atom microformat to XML transcoder, and something I’ve awkwardly called hCard n best-guess. The best-guess script is an attempt to tackle the issues I highlighted in a previous post The Dangers of Automatically Generating hCards. If you find yourself in a situation whereby you really have no choice but to deal with a name as a single string (which may or may not be in a format compatible with the hCard n-optimisation rules), the best-guess script will attempt to guess the component name parts and return a valid value for fn. For example, given a string of Mr Henry Ford (view source on the output) the script will detect ‘Mr’ as an honorific prefix and then guess ‘Henry’ as a given-name and ‘Ford’ as a family-name. Of course it’s not foolproof, but it does serve as a good last-ditch attempt if you’ve no other option in attempting to create a valid hCard from a single name string.

The other item I wished to mention is something that’s been developed by the most efficient JavaScript development technique I’ve found so far – namely, having lunch with Chris Heilmann and moaning about the libraries you wish you had. Then magically, seemingly out of nowhere, said library appears! If only this technique scaled.

The Class Scanner Tool is a JavaScript micro-library for handling the common tasks in getting, setting, removing and finding elements by the class attribute. As the DOM isn’t specific to HTML, the class attribute has no special status and so any operations on that attribute need to take account of the value being a space-delimited string of values. You can really screw stuff up by indiscriminately assigning a value to the class attribute as it will trounce over whatever is already there. As a space-delimited string clearly isn’t a native data type in JavaScript, you frequently end up needing to utilise a regular expression to even test of a value has been assigned. As you can imagine, this is both fiddly and extremely common work, especially if you’re styling dynamic elements with CSS or working with microformats – both of which rely heavily on the class attribute. The idea of this library is to provide that commonly needed functionality in a compact way that can just be dropped in to a project. Most of the big libraries have this kind of functionality buried in there somewhere, but often importing a big library for a small job is overkill. So this is just perfect. Thanks Chris!

Upcoming Events

There’s a few events coming up in the next month or two that may be of interest to microformats geeks in and around London, UK. The first is BarCampLondon (2nd — 3rd September — at Yahoo! Europe, Shaftesbury Avenue, WC2H 8AD), which as far as I know is the first BarCamp to be held on these shores. Unfortunately, places at the location are limited, and if you’ve not already signed up places have now all gone. I’m hoping to be able to demo some prototypes of microformats user interface ideas I’ve been hacking on, and I know of at least a couple of others who are planning to contribute items related to microformats work. Should be a good event. The second event is a social we’re calling a London Microformats vEvent, which will be happening in a microbrewery somewhere in London on September 30th, 2006. Details are still a little sketchy, so do chime in with recommendations and add yourself to the page if you’d like to attend. Can’t take much credit for this one, as most of the hard work is being done by Frances Berriman.

Lastly, following on from the success of the first London WSG meetup, Stuart Colville is planning a microformats special for sometime in October (date to be finalised). It’s great to see so much buzz around microformats at the moment, and I’m sure it’s going to continue into the autumn and beyond.