[microformats-discuss] A 10 line script to identify and process
any microformat
Mark Rickerby
coretxt at gmail.com
Thu Jul 28 21:57:10 PDT 2005
> 1. We're optimizing for publishers, not consumers. Yes, parsing
> microformats is *hard* and no one is claiming its easy.
> 2. This seems like needless complexity. Though its tough, you can get
> the data out.
> 3. A universal parsing apparatus is not possible. You could probably
> get a system that's pretty flexible and can handle a good number of
> formats, but you will not likely be able to create something with
> unlimited abilities.
> 4. What happens when everyone's using microformats everywhere? :D
>
> > Then the main selector can be
> > var mc = document.evaluate(//*[contains(@class,'microdata')]",
> > document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
> > and you only have to check the big list of possible classnames
> > against that one node.
> >
> > For example, <div class="microdata xfolkentry"> or <div
> > class="microdata hreview"> .
>
> BTW, this is probably a good discussion to have on the microformats-
> discuss list.
>
One thing I think it is worth pointing out with regards this
discussion, is that there's a big difference between *identifying*
that a microformat is in use, and actually *processing* the
microformat.
Identification is fairly straightforward, as these GM scripts have
demonstrated. But what's involved in processing? You need to parse the
information into a data structure, and then do something with that
data structure, which would probably take a lot more than 3-4 lines of
javascript, not to mention the design/creativity involved in doing
something useful with the data. But therein lies the potential...
You can post suggestions/requests for Greasemonkey scripts at:
http://dunck.us/collab/GreaseMonkeyUserScriptRequest
If you have something microformats specific that you'd like to see a
Greasemonkey script to handle, please post it there.
As the wiki says, "smart people are listening".
/M
More information about the microformats-discuss
mailing list