[uf-discuss] Experimental implementation of hAtom on diveintomark.org

David Janes -- BlogMatrix davidjanes at blogmatrix.com
Wed Mar 15 13:13:21 PST 2006


Mark Pilgrim wrote:
> http://beta.diveintomark.org/archives/2004/10/18/exit
> 
> Based on Wordpress 2.0.2.  No changes were required in the Wordpress
> code; it already marks up categories with rel="tag", and everything
> else could be done in my theme files.
> 
> One question: does the vCard need to be inside the hentry?  Because
> mine isn't, and it would be inconvenient (though not impossible) to
> move it.  I see something on the wiki about a "nearest in parent"
> algorithm, but I missed the discussion about it and I'm not
> comprehending the sample code at the moment.

It's looking good to me -- I'm just putting the finishing touches on a 
version of the AUMFP for hAtom 0.1. Here's what I'm seeing right now 
(hopefully this isn't too obtuse):

{'@index': 'hentry-1',
  'author': [{'@index': 'vcard-1',
              u'fn': u'Mark Pilgrim',
              'n.family-name': u'Pilgrim',
              'n.given-name': u'Mark',
              u'url': u'mailto:mark at diveintomark.org'}],
  u'bookmark': u'http://beta.diveintomark.org/archives/2004/10/18/exit',
  u'entry-content': u'<p>It\u2019s time for me to find a new hobby. 
Preferably one that\ndoesn\u2019t involve angle brackets. Or computers. 
Or\nelectricity.</p>',
  u'entry-title': u'Every exit',
  'tag': [{'@index': 'tag-1',
           u'name': u'general',
           u'uri': 
u'http://beta.diveintomark.org/archives/rooms/general/'}]}

The algorithm kinda sucks and is misnamed as Dimitri notes. Here's what 
I'm doing now.

Basic loop -- look through parents:
- look at the parent of the 'entry' for a "proper hCard"
- if any hCards found, use all of them
- if not found, repeat on the parent of the parent

Definition of a "proper hCard":
- it must be an <address>
- it must have class 'author'
- it must not be in an entry

This is a little more comprehensible. The next change I would suggest 
(for 0.2) is that the (hcard author) should be findable inside of an 
<address> element.

Regards, etc...
David




More information about the microformats-discuss mailing list