view release on metacpan or search on metacpan
Makefile.PL
MANIFEST This list of files
META.yml
meta/changes.ttl
meta/doap.ttl
meta/makefile.ttl
meta/rt-bugs.ttl
README
t/01basic.t
t/10hcard.t
t/11hcalendar.t
t/12hatom.t
t/13xfn.t
t/14reltag.t
t/15rellicense.t
TODO
SIGNATURE Public-key signature (added by MakeMaker)
SHA1 3dcc2e7893aa94184cc4929f1aab3a859710b51b lib/HTML/Microformats/Mixin/Parser.pm
SHA1 0dfbaf34aa7ad9f4b946f95c509107efa8df7b68 lib/HTML/Microformats/Mixin/RDF.pm
SHA1 d47b2d50278a7dbc33dc756abb8e9d8148234532 lib/HTML/Microformats/ObjectCache.pm
SHA1 8659e5d1561f3a861290274bdc4e32e96a2b5437 lib/HTML/Microformats/Utilities.pm
SHA1 de16d8c5dc3dee776649116bdc0aa25ebea869b8 meta/changes.ttl
SHA1 af96307b9110c326955e775d546c771a21e5631c meta/doap.ttl
SHA1 4cd667210d726b42ea6a4c9bd08cb27c9c89060d meta/makefile.ttl
SHA1 07eaa9fca95c71c84f9f28361eb11cae379ab1a3 meta/rt-bugs.ttl
SHA1 b860cbfb1804e58c949b431f70f3b18c0da4c26b t/01basic.t
SHA1 c52c3ec4f2f8a1493aa35bc2d2a3fb079e55f147 t/10hcard.t
SHA1 e0db34b707609846e4416d34c07bbf1c7c7b49d3 t/11hcalendar.t
SHA1 d04107962b8a3aedc7ea431656ae89597460bdf0 t/12hatom.t
SHA1 8573f4f7158d91bb9d366514bf5c7264415ca78f t/13xfn.t
SHA1 2fd970137bfa4a1939f16f18b80a5cab0495d9b7 t/14reltag.t
SHA1 295cd4a985e7d45467c2ac2424a2ea4e45d638e6 t/15rellicense.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iEYEARECAAYFAk/2CBMACgkQzr+BKGoqfTnZFQCeIf9JPtTY3GYb05xj3+lAZIaG
wKgAoLQoFjie++fOoKkxWhcE2lgND6Je
=Xovy
examples/misc/example5.pl view on Meta::CPAN
</div>
<div class="hentry hnews" id="foo">
<h1>Foo</h1>
<p class="dateline">London, UK (<span class="geo">12.34,56.78</span>).</p>
<p class="entry-summary entry-content">Foo bar.</p>
<p class="vcard author"><a href="mailto:eve\@example.com" class="fn url">Eve</a></p>
<a rel="tag" href="test">Test</a>
<span class="updated published">2010-03-01T15:00:00+0000</span>
<a rev="vote-against" href="http://evil.com/">I don't like Evil</a>.
</div>
<div class="vcalendar">
<p class="vevent" id="bar">
<span class="dtstart">2010-02-03</span>
<span class="summary">3 Feb 2010</span>
<span class="rrule">
<i class="freq">Yearly</i>,
every <i class="interval">10000</i> years.
</span>
<span class="rrule">freq=daily;interval=365220</span>
<span class="geo">1;2</span>
<span class="duration">PT24H</span>
examples/misc/example5.pl view on Meta::CPAN
<span class="value">2001-01-01/P6M</span>
<span class="value"><i class="start">2002-01-01</i> <i class="d">182</i></span>
</span>
<span class="summary">freetime</span>
</div>
<ul class="vtodo-list">
<li id="a">Do this</li>
<li id="b">Do that
<ol>
<li id="b1">Do that: part 1</li>
<li id="b2">Do that: part 2 <a href="foo" rel="vcalendar-parent">p</a></li>
</ol>
</li>
</ul>
<p class="vevent">
<b class="dtstart">
<i class="value">13:00:00</i>
<i class="value">2008-02-01</i>
<i class="value">+0100</i>
</b>
<b class="dtend">
lib/HTML/Microformats/Datatype/DateTime/Parser.pm view on Meta::CPAN
$p{ parsed }{ time_zone } .= '000';
}
return 1;
}
sub _normalize_week {
my %p = @_;
# from section 4.3.2.2
# "A calendar week is identified within a calendar year by the calendar
# week number. This is its ordinal position within the year, applying the
# rule that the first calendar week of a year is the one that includes the
# first Thursday of that year and that the last calendar week of a
# calendar year is the week immediately preceding the first calendar week
# of the next calendar year."
# this make it oh so fun to covert an ISO week number to a count of days
my $dt = DateTime->new(
year => $p{ parsed }{ year },
);
if ( $dt->week_number == 1 ) {
$p{ parsed }{ week } -= 1;
}
lib/HTML/Microformats/Documentation/Notes.pod view on Meta::CPAN
Exports as vCard 3.0.
=item * C<to_vcard4> (hCard objects)
Exports as vCard 4.0.
=item * C<to_vcard4_xml> (hCard objects)
Exports as vCard XML.
=item * C<to_icalendar> (hCalendar, hEvent, hTodo, hFreebusy, hAlarm and hEntry objects)
Exports as iCalendar.
=item * C<to_atom> (hAtom and hEntry objects)
Exports as Atom 1.0.
=item * C<to_kml> (geo objects)
Exports as KML 2.0.
lib/HTML/Microformats/Format/hAlarm.pm view on Meta::CPAN
foreach my $alarm ($ev->get_valarm)
{
print $alarm->get_description . "\n";
}
}
}
=head1 DESCRIPTION
HTML::Microformats::Format::hAlarm is a helper module for HTML::Microformats::Format::hCalendar.
This class is used to represent alarm components within calendars. Generally speaking,
you want to use HTML::Microformats::Format::hCalendar instead.
HTML::Microformats::Format::hAlarm inherits from HTML::Microformats::Format. See the
base class definition for a description of property getter/setter methods,
constructors, etc.
=head2 Additional Method
=over
=item * C<< to_icalendar >>
This method exports the data in iCalendar format. It requires
L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hAlarm;
lib/HTML/Microformats/Format/hAlarm.pm view on Meta::CPAN
}
return $self;
}
sub profiles
{
return HTML::Microformats::Format::hCalendar::profiles(@_);
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n"
unless $HTML::Microformats::Format::hCalendar::HAS_ICAL_EXPORT;
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_component($self->model, $self->id(1))->to_string;
}
1;
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
=head1 DESCRIPTION
HTML::Microformats::Format::hCalendar inherits from HTML::Microformats::Format. See the
base class definition for a description of property getter/setter methods,
constructors, etc.
=head2 Additional Method
=over
=item * C<< to_icalendar >>
This method exports the data in iCalendar format. It requires
L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hCalendar;
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
};
bless $self, $class;
my $clone = $element->cloneNode(1);
$self->_expand_patterns($clone);
$self->_simple_parse($clone);
foreach my $todolist (searchClass('vtodo-list', $element))
{
my $holder_calendar = searchAncestorClass('vcalendar', $todolist);
if (!defined $holder_calendar or
$element->getAttribute('data-cpan-html-microformats-nodepath') eq $holder_calendar->getAttribute('data-cpan-html-microformats-nodepath'))
{
push @{$self->{'DATA'}->{'vtodo'}},
HTML::Microformats::Format::hTodo->extract_all_xoxo($todolist, $context);
}
}
$self->_calculate_relationships;
$self->_cement_relationships;
$cache->set($context, $element, $class, $self)
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
if ($element->tagName eq 'html' || !@cals)
{
my @components = HTML::Microformats::Format::hEvent->extract_all($element, $context);
push @components, HTML::Microformats::Format::hTodo->extract_all($element, $context);
push @components, HTML::Microformats::Format::hFreebusy->extract_all($element, $context);
push @components, HTML::Microformats::Format::hEntry->extract_all($element, $context);
my $orphans = 0;
foreach my $c (@components)
{
$orphans++ unless searchAncestorClass('hcalendar', $c->element);
}
if ($orphans)
{
my $slurpy = $class->new($element, $context);
unshift @cals, $slurpy;
}
}
return @cals;
}
sub format_signature
{
my $ical = 'http://www.w3.org/2002/12/cal/icaltzd#';
return {
'root' => 'vcalendar',
'classes' => [
['vevent', 'M*', {embedded=>'hEvent'}],
['vtodo', 'M*', {embedded=>'hTodo'}],
['hentry', 'M*', {embedded=>'hEntry', 'use-key'=>'vjournal'}],
['vfreebusy', 'M*', {embedded=>'hFreebusy'}],
['calscale', '?'],
['method', '?'],
],
'options' => {
},
'rdf:type' => ["${ical}Vcalendar"] ,
'rdf:property' => {
'vevent' => { 'resource' => ["${ical}component"] } ,
'vtodo' => { 'resource' => ["${ical}component"] } ,
'vfreebusy' => { 'resource' => ["${ical}component"] } ,
'vjournal' => { 'resource' => ["${ical}component"] } ,
'calscale' => { 'literal' => ["${ical}calscale"] , 'literal_datatype' => 'string'} ,
'method' => { 'literal' => ["${ical}method"] , 'literal_datatype' => 'string'} ,
},
};
}
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
{
$journal->add_to_model_ical($model);
}
return $self;
}
sub profiles
{
return qw(http://purl.org/uF/hCalendar/1.1/
http://microformats.org/profile/hcalendar
http://ufs.cc/x/hcalendar
http://microformats.org/profile/specs
http://ufs.cc/x/specs
http://dannyayers.com/microformats/hcalendar-profile
http://www.w3.org/2002/12/cal/hcal
http://purl.org/uF/hCalendar/1.0/
http://purl.org/uF/2008/03/);
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n" unless $HAS_ICAL_EXPORT;
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_calendar($self->model, $self->id(1))->to_string;
}
1;
=head1 MICROFORMAT
HTML::Microformats::Format::hCalendar supports hCalendar as described at
L<http://microformats.org/wiki/User:TobyInk/hcalendar-1.1>.
=head1 RDF OUTPUT
Data is returned using the W3C's revised iCalendar vocabulary
(L<http://www.w3.org/2002/12/cal/icaltzd#>) with some supplemental
terms from Toby Inkster's revised iCalendar extensions vocabulary
(L<http://buzzword.org.uk/rdf/icaltzdx#>) and occasional other terms.
=head1 BUGS
lib/HTML/Microformats/Format/hCard.pm view on Meta::CPAN
if defined $cache && $cache->get($context, $element, $class);
my $self = {
'element' => $element ,
'context' => $context ,
'cache' => $cache ,
'id' => $context->make_bnode($element) ,
'id.holder' => $context->make_bnode ,
};
$self->{'in_hcalendar'} = $options{'in_hcalendar'};
bless $self, $class;
my $clone = $element->cloneNode(1);
$self->_expand_patterns($clone);
$self->_simple_parse($clone);
# In hCalendar, 'cn' is used instead of 'fn'.
if ($self->{'in_hcalendar'})
{
$self->{'DATA'}->{'fn'} = $self->{'DATA'}->{'cn'}
if defined $self->{'DATA'}->{'cn'}
&& !defined $self->{'DATA'}->{'fn'};
}
# Find more complicated nested structures.
# These can't be handled by _simple_parse.
push @{ $self->{'DATA'}->{'n'} }, HTML::Microformats::Format::hCard::n->extract_all($clone, $context);
push @{ $self->{'DATA'}->{'org'} }, HTML::Microformats::Format::hCard::org->extract_all($clone, $context);
lib/HTML/Microformats/Format/hCard.pm view on Meta::CPAN
'uid' => { 'resource' => ["${vcard}uid"], 'literal' => ["${vcard}uid"] },
'url' => { 'resource' => ["${vcard}url"] },
'cn' => { 'literal' => ["${ical}cn"] },
'cutype' => { 'literal' => ["${ical}cutype"] },
'rsvp' => { 'literal' => ["${ical}rsvp"] },
'delegated-from' => { 'resource' => ["${ix}delegatedFrom"] , 'literal' => ["${ical}delegatedFrom"] },
'sent-by' => { 'resource' => ["${ix}sentBy"] , 'literal' => ["${ical}sentBy"] },
},
};
if (ref $self and $self->{'in_hcalendar'})
{
push @{ $rv->{'classes'} }, ( # these are ALL extensions
['cn', '?'],
['cutype', '?'],
['member', '?'],
['rsvp', '?'],
['delegated-from', 'Mu*',{'embedded'=>'hCard'}],
['sent-by', 'Mu*', {'embedded'=>'hCard'}],
);
$rv->{'rdf:property'}->{'member'} = { 'resource' => ["${ix}member"] , 'literal' => ["${ix}member"] };
lib/HTML/Microformats/Format/hEntry.pm view on Meta::CPAN
=head2 Additional Method
=over
=item * C<< to_atom >>
This method exports the data as an XML file containing an Atom <entry>.
It requires L<XML::Atom::FromOWL> to work, and will throw an error at
run-time if it's not available.
=item * C<< to_icalendar >>
This method exports the data in iCalendar format (as a VJOURNAL). It
requires L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hEntry;
lib/HTML/Microformats/Format/hEntry.pm view on Meta::CPAN
}
sub to_atom
{
my ($self) = @_;
die "Need XML::Atom::FromOWL to export Atom.\n" unless $HAS_ATOM_EXPORT;
my $exporter = XML::Atom::FromOWL->new;
return $exporter->export_entry($self->model, $self->id(1))->as_xml;
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n"
unless $HTML::Microformats::Format::hCalendar::HAS_ICAL_EXPORT;
my $model = $self->model;
$self->add_to_model_ical($model);
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_component($model, $self->id(1))->to_string;
lib/HTML/Microformats/Format/hEvent.pm view on Meta::CPAN
{
foreach my $ev ($cal->get_vevent)
{
printf("%s: %s\n", $ev->get_dtstart, $ev->get_summary);
}
}
=head1 DESCRIPTION
HTML::Microformats::Format::hEvent is a helper module for HTML::Microformats::Format::hCalendar.
This class is used to represent event components within calendars. Generally speaking,
you want to use HTML::Microformats::Format::hCalendar instead.
HTML::Microformats::Format::hEvent inherits from HTML::Microformats::Format. See the
base class definition for a description of property getter/setter methods,
constructors, etc.
=head2 Additional Method
=over
=item * C<< to_icalendar >>
This method exports the data in iCalendar format. It requires
L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hEvent;
lib/HTML/Microformats/Format/hEvent.pm view on Meta::CPAN
my ($self, $element) = @_;
# Related-to - too tricky for simple_parse()
my @relations = searchClass('related-to', $element);
foreach my $r (@relations)
{
if ($r->tagName !~ /^(a|area|link)$/i)
{
push @{$self->{'DATA'}->{'sibling'}}, stringify($r, 'value');
}
elsif ($r->getAttribute('rel') =~ /vcalendar-parent/i && !defined $self->{'DATA'}->{'parent'})
{
$self->{'DATA'}->{'parent'} = $self->context->uri($r->getAttribute('href'));
}
elsif ($r->getAttribute('rel') =~ /vcalendar-child/i)
{
push @{$self->{'DATA'}->{'child'}}, $self->context->uri($r->getAttribute('href'));
}
else
{
push @{$self->{'DATA'}->{'sibling'}}, $self->context->uri($r->getAttribute('href'));
}
}
# If no parent, then try to find a link with rel="vcalendar-parent" but no
# class="related-to".
unless ($self->{'DATA'}->{'parent'})
{
@relations = searchRel('vcalendar-parent', $element);
my $r = shift @relations;
$self->{'DATA'}->{'parent'} = $self->context->uri($r->getAttribute('href')) if ($r);
}
# Find additional siblings.
@relations = searchRel('vcalendar-sibling', $element);
foreach my $r (@relations)
{
push @{$self->{'DATA'}->{'sibling'}}, $self->context->uri($r->getAttribute('href'))
unless $r->getAttribute('class') =~ /\b(related-to)\b/;
}
# Find additional children.
@relations = searchRel('vcalendar-child', $element);
foreach my $r (@relations)
{
push @{$self->{'DATA'}->{'child'}}, $self->context->uri($r->getAttribute('href'))
unless $r->getAttribute('class') =~ /\b(related-to)\b/;
}
return $self;
}
sub format_signature
lib/HTML/Microformats/Format/hEvent.pm view on Meta::CPAN
));
}
}
}
sub profiles
{
return HTML::Microformats::Format::hCalendar::profiles(@_);
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n"
unless $HTML::Microformats::Format::hCalendar::HAS_ICAL_EXPORT;
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_component($self->model, $self->id(1))->to_string;
}
1;
lib/HTML/Microformats/Format/hFreebusy.pm view on Meta::CPAN
{
foreach my $fb ($cal->get_vfreebusy)
{
printf("%s\n", $fb->get_summary);
}
}
=head1 DESCRIPTION
HTML::Microformats::Format::hFreebusy is a helper module for HTML::Microformats::hCalendar.
This class is used to represent free/busy scheduling components within calendars, which (in practice)
are never really published as hCalendar. Generally speaking, you want to use
HTML::Microformats::hCalendar instead.
HTML::Microformats::Format::hFreebusy inherits from HTML::Microformats::Format. See the
base class definition for a description of property getter/setter methods,
constructors, etc.
=head2 Additional Method
=over
=item * C<< to_icalendar >>
This method exports the data in iCalendar format. It requires
L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hFreebusy;
lib/HTML/Microformats/Format/hFreebusy.pm view on Meta::CPAN
}
return $self;
}
sub profiles
{
return HTML::Microformats::Format::hCalendar::profiles(@_);
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n"
unless $HTML::Microformats::Format::hCalendar::HAS_ICAL_EXPORT;
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_component($self->model, $self->id(1))->to_string;
}
1;
lib/HTML/Microformats/Format/hResume.pm view on Meta::CPAN
my $cv = "http://purl.org/captsolo/resume-rdf/0.2/cv#";
my $cvx = "http://ontologi.es/hresume#";
# parsing hCards seems to do more harm than good!
my $rv = {
'root' => 'hresume',
'classes' => [
['summary', '?'],
['contact', 'm?', {'embedded'=>'hCard'}],
['address', 'tm?', {'embedded'=>'hCard'}],
['education', 'm*', {'embedded'=>'hEvent', 'allow-interleaved' => ['vcalendar']}], #}],, 'again-again'=>1}],
#['education', 'm*', {'embedded'=>'hCard', 'allow-interleaved' => ['vcalendar', 'vevent'], 'use-key'=>'education-hcard'}],
['experience', 'm*', {'embedded'=>'hEvent', 'allow-interleaved' => ['vcalendar']}], #}],, 'again-again'=>1}],
#['experience', 'm*', {'embedded'=>'hCard', 'allow-interleaved' => ['vcalendar', 'vevent'], 'use-key'=>'experience-hcard'}],
['skill', '*'],
['affiliation', 'M*', {'embedded'=>'hCard'}],
['cite', 't', {'use-key'=>'publication'}]
],
'options' => {
},
'rdf:type' => ["${cv}CV"] ,
'rdf:property' => {
'summary' => { 'literal' => ["${cv}cvDescription"] },
'experience' => { 'resource' => ["${cvx}experience"] },
lib/HTML/Microformats/Format/hTodo.pm view on Meta::CPAN
{
foreach my $todo ($cal->get_vtodo)
{
printf("%s: %s\n", $todo->get_due, $todo->get_summary);
}
}
=head1 DESCRIPTION
HTML::Microformats::Format::hTodo is a helper module for HTML::Microformats::Format::hCalendar.
This class is used to represent todo components within calendars. Generally speaking,
you want to use HTML::Microformats::Format::hCalendar instead.
HTML::Microformats::Format::hTodo inherits from HTML::Microformats::Format. See the
base class definition for a description of property getter/setter methods,
constructors, etc.
=head2 Additional Method
=over
=item * C<< to_icalendar >>
This method exports the data in iCalendar format. It requires
L<RDF::iCalendar> to work, and will throw an error at run-time
if it's not available.
=back
=cut
package HTML::Microformats::Format::hTodo;
lib/HTML/Microformats/Format/hTodo.pm view on Meta::CPAN
next OTHERCHILD if $child == $other_child;
push @{$child->{'related'}->{'sibling'}}, $other_child;
}
push @rv, $child;
}
return @rv;
}
sub to_icalendar
{
my ($self) = @_;
die "Need RDF::iCalendar to export iCalendar data.\n"
unless $HTML::Microformats::Format::hCalendar::HAS_ICAL_EXPORT;
my $exporter = RDF::iCalendar::Exporter->new;
return $exporter->export_component($self->model, $self->id(1))->to_string;
}
1;
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
# nested microformats (e.g. vcard class="agent vcard") should be
# dealt with BEFORE calling the destroyer! Because of the
# destructive nature of this function, make sure that you only
# use it on a clone of the real node.
sub _destroyer
{
my $self = shift;
my $element = shift;
# Classes to be destroyed
my @containers = qw(mfo vcard adr geo vcalendar vevent vtodo valarm
vfreebusy hfeed hentry hslice hreview hresume xfolkentry biota haudio
hmeasure hangle hmoney hlisting vtodo-list figure hproduct hnews);
my %C;
foreach my $c (@containers) { $C{$c}=1; }
# Some classes may be retained, optionally.
foreach my $c (@_) { $C{$c}=0; }
# Assemble them all into the regular expression of death.
@containers = ();
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
my $options = $self->format_signature->{'options'} || {};
my $page = $self->context;
# So far haven't needed any more than this.
my $uf_roots = {
'hCard' => 'vcard',
'hEvent' => 'vevent',
'hAlarm' => 'valarm',
'hTodo' => 'vtodo',
'hFreebusy' => 'vfreebusy',
'hCalendar' => 'vcalendar',
'hMeasure' => 'hmeasure|hangle|hmoney',
'species' => 'biota',
'hAtom' => 'hfeed'
};
# Derived from HTML::Tagset, but some modifications to the order of attrs.
my $link_elements = {
'a' => ['href'],
'applet' => ['codebase', 'archive', 'code'],
'area' => ['href'],
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
else
{
# This is a little bit of extra code that checks for interleaving uF
# root class elements and excludes them. For example, in the following,
# the outer hCard should not have an agent:
# <div class="vcard">
# <p class="birth vcard">
# <span class="agent vcard"></span>
# </p>
# </div>
my @mfos = qw(mfo vcard adr geo vcalendar vevent vtodo valarm
vfreebusy hfeed hentry hslice hreview hresume xfolkentry biota haudio
hmeasure hangle hmoney hlisting vtodo-list figure hproduct hnews);
my $mfos = '\b('.(join '|', @mfos).')\b';
foreach my $u (@{$class_options->{'allow-interleaved'}})
{ $mfos =~ s/\|$u//; }
foreach my $mn (@matching_nodes)
{
my $is_ok = 1;
my $ancestor = $mn->parentNode;
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
if ($uf eq '!person')
{
# This is used as a last-ditch attempt to parse a person.
my $obj = HTML::Microformats::Format::hCard->new_fallback($node, $self->context);
push @node_parsed_objects, $obj;
}
elsif ($node->getAttribute('class') =~ /\b($uf_class)\b/)
{
my $pkg = 'HTML::Microformats::Format::'.$uf;
my $obj = eval "${pkg}->new(\$node, \$self->context, in_hcalendar => \$class_options->{'is-in-cal'});";
push @node_parsed_objects, $obj;
}
else
{
my $pkg = 'HTML::Microformats::Format::'.$uf;
my @all = eval "${pkg}->extract_all(\$node, \$self->context, in_hcalendar => \$class_options->{'is-in-cal'});";
push @node_parsed_objects, @all if @all;
}
$self->_simple_parse_found_error('W', "Multiple embedded $uf objects found in a single $class property. This is weird.")
if defined $node_parsed_objects[1];
}
use strict 'refs';
# If we've found something
if (defined $node_parsed_objects[0] && ref $node_parsed_objects[0])
t/11hcalendar.t view on Meta::CPAN
<p class="vtodo">
<i class="dtstart">XXX <b class="value-title" title="2001-02-03T01:02:03+0100"></b> 3 Feb</i>
<i class="summary">Todo 01 - invalid value-title</i>
</p>
HTML
my $document = HTML::Microformats->new_document($html, 'http://example.com/');
$document->assume_all_profiles;
my ($calendar) = $document->objects('hCalendar');
my @events = sort { $a->data->{summary} cmp $b->data->{summary} }
@{ $calendar->get_vevent };
is($events[0]->get_dtstart,
'2001-02-03T01:02:03+0100',
$events[0]->get_summary);
is($events[1]->get_dtstart,
'2001-02-03T01:02:03+0100',
$events[1]->get_summary);
is($events[2]->get_dtstart,
t/11hcalendar.t view on Meta::CPAN
is($events[10]->get_dtend,
'2001-02-03T13:07:03+0100',
$events[10]->get_summary);
is($events[11]->get_dtend,
'2001-02-03T13:07:03+0100',
$events[11]->get_summary);
my @todos = sort { $a->data->{summary} cmp $b->data->{summary} }
@{ $calendar->get_vtodo };
is($todos[0]->get_dtstart,
undef,
$todos[0]->get_summary);