Skip Menu |

This queue is for tickets about the HTML-Microformats CPAN distribution.

Report information
The Basics
Id: 84411
Status: open
Priority: 0/
Queue: HTML-Microformats

People
Owner: perl [...] toby.ink
Requestors: garu [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.105
Fixed in: (no value)



Subject: support for microformats 2
Hi Toby, thanks for creating such a robust microformats handler! I was hoping it would also support microformats 2 (http://microformats.org/wiki/microformats-2) as it's being developed for two years now and is already seen in the wild (http://microformats.org/wiki/microformats-2#Examples_in_the_wild). But either I'm doing something very wrong or HTML::Microformats does not support (yet) the microformats 2 spec. Here's my sample code: ----------8<---------- use strict; use warnings; use HTML::Microformats; my $doc = HTML::Microformats->new_document( '<span class="h-card">Frances Berriman</span>', 'http://microformats.org/profile/h-card' )->assume_profile( 'hCard' ); print $doc->json( pretty => 1 ); ---------->8---------- According to their documentation, it is supposed to output this: { "items": [{ "type": ["h-card"], "properties": { "name": ["Frances Berriman"] } }] } but instead I get this: { "adr" : [], "hCard" : [], "geo" : [] } Maybe I did something stupid, but I'm assuming the hCard format is only for microformats v1, and v2 needs new format handlers, like HTML::Microformats::Format::h_card or something. Or maybe it can be bundled into the original parser, I don't know. What do you think? Can I has microformats 2? :) Thanks! And thanks again for such a cool module!
Show quoted text
> Maybe I did something stupid, but I'm assuming the hCard format is > only for microformats v1, and v2 needs new format handlers, like > HTML::Microformats::Format::h_card or something. Or maybe it can be > bundled into the original parser, I don't know. > > What do you think? Can I has microformats 2? :)
This is something that's been on my mental todo list for a while. The way I'd probably do it would be to have a single HTML::Microformats::Format::uf2 class to do the basic parsing but that would have no special knowledge of each individual format. And then some sort of gubbins within HTML::Microformats::Format::hCard (and friends) to then pick up hCards from the uf2 parser and "lift" them into full HTML::Microformats::Format::hCard objects.
On Wed Apr 03 18:07:42 2013, TOBYINK wrote: Show quoted text
> > What do you think? Can I has microformats 2? :)
> > This is something that's been on my mental todo list for a while. > > The way I'd probably do it would be to have a single > HTML::Microformats::Format::uf2 class to do the basic parsing but that > would have no special knowledge of each individual format. > > And then some sort of gubbins within HTML::Microformats::Format::hCard > (and friends) to then pick up hCards from the uf2 parser and "lift" > them into full HTML::Microformats::Format::hCard objects.
Sounds great! Hope to see a new CPAN release anytime soon :D *runs off into the wilderness* Seriously, though, you rock! Thanks for the quick response and remarks, let me know if you get a beta release out in the open so I can test it for you, ok? I couldn't find any Perl parsers for microformats 2 and was really hoping I could plug yours in. Cheers!