If you’re a Mac developer, you’ve likely heard of Sparkle, the little framework for application updates.
One feature I would love Sparkle to have, is extracting update information from a HTML page instead of an RSS appcast feed. Most “download” or “release notes” pages already have nearly all the information Sparkle needs. Not having to maintain a separate appcast is less work, and less error prone.
Microformats to the Rescue
Microformats can help here. Let me quote the description of what Microformats are, for those who are unfamiliar with Microformats:
Microformats are small bits of HTML that represent things like people, events, tags etc. in webpages.
To give a quick example of how Microformats can be useful, assume your “about” page has the following line:
<p>Hi! I'm Denis Defreyne.</p>
You’d need a English language parser to extract the full name from that about page. With Microformats though, you’d simply mark up your full name using hCard, like this:
<p class="vcard">
Hi! I'm <span class="fn">Denis Defreyne</span>.
</p>
(Obviously, you can mark up much more data using hCard, ranging from home addresses to telephone numbers. Check out the hCard wiki page to find out more.)
In a browser with Microformats support (such as NetNewsWire), someone could add your address card to the system’s Address Book with a single click. Nifty.
Enter hAtom
hAtom is a microformat for syndicating content, such as blog posts. In other words, it’s used to mark up blog posts’ title, author, publish date, content, summary, … so that feed readers can use HTML pages as feeds instead of RSS/Atom files.
So, basically, if Sparkle would support hAtom, then you’d be able get rid of your RSS appcast feed and simply use your “download” or “release notes” HTML page as an appcast feed.
Imagine having the following version history page (I based this one off Adium’s version history):
<html>
<head>
<title>Version History</title>
</head>
<body>
<h1>Version History</h1>
<div>
<h2>Adium 1.0.4</h2>
<p>Released on 24 June.</p>
<div>
<ul>
<li>Fixed a crash introduced in 1.0.3</li>
<li>Fixed group chat when message history is enabled</li>
</ul>
<p><a href="http://adiumx.cachefly.net/Adium_1.0.4.dmg">Download</a>.</p>
</div>
</div>
</body>
</html>
This is a simple, straightforward HTML page, with release notes for a single application version. (I’ve only included one application version for clarity.)
To allow Sparkle to extract update information from this page, we need to mark up the download URL and the release notes for each version. Adding hAtom could result in something like this:
<html>
<head>
<title>Version History</title>
</head>
<body>
<h1>Version History</h1>
<div class="hentry">
<h2 class="entry-title">Adium 1.0.4</h2>
<p>Released on <abbr class="updated" title="2007-06-20T18:00+01:00">24 June</abbr>.</p>
<div class="entry-content">
<ul>
<li>Fixed a crash introduced in 1.0.3</li>
<li>Fixed group chat when message history is enabled</li>
</ul>
<p><a href="http://adiumx.cachefly.net/Adium_1.0.4.dmg" rel="enclosure">Download</a>.</p>
</div>
</div>
</body>
</html>
And that’s it. If Sparkle supported hAtom, you’d have been able to use your HTML download page instead of a separate RSS appcast.
An Appcast Microformat
The title of this post is a bit misleading. It’s not just about hAtom—it’s really about an appcast microformat.
hAtom by itself doesn’t suffice for appcasts. Sparkle-flavoured RSS appcasts have extra attributes, such as MD5 checksums (sparkle:md5Sum). Such attributes will have to be marked up in HTML as well.
This appcast microformat will be built on top of hAtom and perhaps other existing microformats, adding some appcast-specific functionality. Check out its its wiki page over at the Microformats wiki for the gory details.
Help Me Out
The above is just an example of what hAtom support for Sparkle could look like. The appcast microformat is quite new and it’s still in flux.
There’s still quite a few unresolved issues floating around. For example, how should DSA signatures be marked up? Is “appcast” a good name? Could hListing be used instead of hAtom? What’s the best way to mark up version numbers? …
If you’re interested and would like to help out, check out the appcast wiki page and leave some feedback. (Also check out the microformats IRC channel; I’m usually there as well—look for ddfreyne.)
The appcast microformat is still in its early stages, but I’m excited and confident that it’ll end up being something great and really useful.