view release on metacpan or search on metacpan
lib/HTML/Microformats/Format/hCard.pm
lib/HTML/Microformats/Format/hCard/email.pm
lib/HTML/Microformats/Format/hCard/impp.pm
lib/HTML/Microformats/Format/hCard/label.pm
lib/HTML/Microformats/Format/hCard/n.pm
lib/HTML/Microformats/Format/hCard/org.pm
lib/HTML/Microformats/Format/hCard/tel.pm
lib/HTML/Microformats/Format/hCard/TypedField.pm
lib/HTML/Microformats/Format/hEntry.pm
lib/HTML/Microformats/Format/hEvent.pm
lib/HTML/Microformats/Format/hFreebusy.pm
lib/HTML/Microformats/Format/hListing.pm
lib/HTML/Microformats/Format/hMeasure.pm
lib/HTML/Microformats/Format/hNews.pm
lib/HTML/Microformats/Format/hProduct.pm
lib/HTML/Microformats/Format/hRecipe.pm
lib/HTML/Microformats/Format/hResume.pm
lib/HTML/Microformats/Format/hReview.pm
lib/HTML/Microformats/Format/hReview/rating.pm
lib/HTML/Microformats/Format/hReviewAggregate.pm
lib/HTML/Microformats/Format/hTodo.pm
SHA1 0830a50bd9702f90cd0b4e33f91c2004f40ae310 lib/HTML/Microformats/Format/hCard.pm
SHA1 930b493805752960a70f63e4966207acf1f7ba22 lib/HTML/Microformats/Format/hCard/TypedField.pm
SHA1 506e28a53511247cff07f727805b440006b6afd0 lib/HTML/Microformats/Format/hCard/email.pm
SHA1 49a6dab2a178a20761094949c8aab4b00997ced2 lib/HTML/Microformats/Format/hCard/impp.pm
SHA1 6a3192fffc334586ee11fb1161d6b7c1ba6ad839 lib/HTML/Microformats/Format/hCard/label.pm
SHA1 ec3b14f82c4c4c80b8491299910abc3f0d3961bf lib/HTML/Microformats/Format/hCard/n.pm
SHA1 1cf34d5a0c63d7246c0fc9b41a77bab8159a5124 lib/HTML/Microformats/Format/hCard/org.pm
SHA1 851d3fda415eeaf267327f5f6a81308df56c31fb lib/HTML/Microformats/Format/hCard/tel.pm
SHA1 f09fa06f974122a7d4686f5f9949b0a4b1bc9669 lib/HTML/Microformats/Format/hEntry.pm
SHA1 b6bf8c54f19c8e0f3322ebcef27884b4e3ebba69 lib/HTML/Microformats/Format/hEvent.pm
SHA1 3c21014b9b9a4c39902622f6db025323762e567e lib/HTML/Microformats/Format/hFreebusy.pm
SHA1 f504db94f44b75bc8184e47b61f4bbeb47c42cc8 lib/HTML/Microformats/Format/hListing.pm
SHA1 490497774d5ab5d69d0892fd1385aee64f3ae560 lib/HTML/Microformats/Format/hMeasure.pm
SHA1 54d7cb07c2c23b4a4e05dfa0f12cca22ad92e2d9 lib/HTML/Microformats/Format/hNews.pm
SHA1 28e5bcd95bf79f2ee0a55f5fb27ca4ee7ab4f381 lib/HTML/Microformats/Format/hProduct.pm
SHA1 06c0eabd117fefe2aed78390aec06c81d7771619 lib/HTML/Microformats/Format/hRecipe.pm
SHA1 bbeb4f50bf2daaa269804bcd4b5088c9443e59a9 lib/HTML/Microformats/Format/hResume.pm
SHA1 2321a31283a428aa7486a1749e06aaccf98583bb lib/HTML/Microformats/Format/hReview.pm
SHA1 f4a82aa7fd0e797efc6c9be2c719ad584ce5e535 lib/HTML/Microformats/Format/hReview/rating.pm
SHA1 e243a1e865a623d2d9712548666b1978888f12a6 lib/HTML/Microformats/Format/hReviewAggregate.pm
SHA1 9880319d33508420f2b74b1ee73992d8bebf9426 lib/HTML/Microformats/Format/hTodo.pm
examples/misc/example5.pl view on Meta::CPAN
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>
<span class="attendee vcard">
<span class="cn">Toby Inkster</span>
<span class="rsvp">true</span>
</span>
</p>
<div class="vfreebusy">
<span class="freebusy">
<span class="fbtype">free</span>
<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>
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/hCalendar.pm view on Meta::CPAN
use base qw(HTML::Microformats::Format HTML::Microformats::Mixin::Parser);
use strict qw(subs vars); no warnings;
use 5.010;
use HTML::Microformats::Utilities qw(searchClass searchAncestorClass);
use HTML::Microformats::Format::hEntry;
use HTML::Microformats::Format::hEvent;
use HTML::Microformats::Format::hTodo;
use HTML::Microformats::Format::hAlarm;
use HTML::Microformats::Format::hFreebusy;
use Object::AUTHORITY;
BEGIN {
$HTML::Microformats::Format::hCalendar::AUTHORITY = 'cpan:TOBYINK';
$HTML::Microformats::Format::hCalendar::VERSION = '0.105';
}
our $HAS_ICAL_EXPORT;
BEGIN
{
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
sub extract_all
{
my ($class, $element, $context) = @_;
my @cals = HTML::Microformats::Format::extract_all($class, $element, $context);
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);
lib/HTML/Microformats/Format/hCalendar.pm view on Meta::CPAN
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'} ,
},
};
}
sub add_to_model
{
my $self = shift;
lib/HTML/Microformats/Format/hFreebusy.pm view on Meta::CPAN
=head1 NAME
HTML::Microformats::Format::hFreebusy - an hCalendar free/busy component
=head1 SYNOPSIS
use Data::Dumper;
use HTML::Microformats::DocumentContext;
use HTML::Microformats::Format::hCalendar;
my $context = HTML::Microformats::DocumentContext->new($dom, $uri);
my @cals = HTML::Microformats::Format::hCalendar->extract_all(
$dom->documentElement, $context);
foreach my $cal (@cals)
{
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;
use base qw(HTML::Microformats::Format HTML::Microformats::Mixin::Parser);
use strict qw(subs vars); no warnings;
use 5.010;
use HTML::Microformats::Utilities qw(searchClass stringify);
use HTML::Microformats::Datatype::Interval;
use RDF::Trine;
use Object::AUTHORITY;
BEGIN {
$HTML::Microformats::Format::hFreebusy::AUTHORITY = 'cpan:TOBYINK';
$HTML::Microformats::Format::hFreebusy::VERSION = '0.105';
}
sub new
{
my ($class, $element, $context) = @_;
my $cache = $context->cache;
return $cache->get($context, $element, $class)
if defined $cache && $cache->get($context, $element, $class);
lib/HTML/Microformats/Format/hFreebusy.pm view on Meta::CPAN
'context' => $context ,
'cache' => $cache ,
'id' => $context->make_bnode($element) ,
};
bless $self, $class;
my $clone = $element->cloneNode(1);
$self->_expand_patterns($clone);
$self->_simple_parse($clone);
$self->_parse_freebusy($clone);
$cache->set($context, $element, $class, $self)
if defined $cache;
return $self;
}
sub _parse_freebusy
{
my ($self, $elem) = @_;
FREEBUSY: foreach my $fb (searchClass('freebusy', $elem))
{
my @fbtype_nodes = searchClass('fbtype', $fb);
next FREEBUSY unless @fbtype_nodes;
my $FB = { fbtype => stringify($fbtype_nodes[0], {'value-title'=>'allow'}) };
my @value_nodes = searchClass('value', $fb);
VALUE: foreach my $v (@value_nodes)
{
my $val = HTML::Microformats::Datatype::Interval->parse(stringify($v), $v, $self->context);
push @{$FB->{'value'}}, $val if defined $val;
}
push @{$self->{'DATA'}->{'freebusy'}}, $FB;
}
return $self;
}
sub format_signature
{
my $ical = 'http://www.w3.org/2002/12/cal/icaltzd#';
my $icalx = 'http://buzzword.org.uk/rdf/icaltzdx#';
return {
'root' => 'vtodo',
'classes' => [
['attendee', 'M*', {embedded=>'hCard !person', 'is-in-cal'=>1}],
['contact', 'M*', {embedded=>'hCard !person', 'is-in-cal'=>1}],
['comment', '*'],
['dtend', 'd?'],
['dtstamp', 'd?'],
['dtstart', 'd1'],
['duration', 'D?'],
['freebusy', '#+'],
['organizer', 'M?', {embedded=>'hCard !person', 'is-in-cal'=>1}],
['summary', '1'],
['uid', 'U?'],
['url', 'U?'],
],
'options' => {
},
'rdf:type' => ["${ical}Vfreebusy"] ,
'rdf:property' => {
'attendee' => { 'resource' => ["${ical}attendee"], 'literal' => ["${icalx}attendee-literal"] } ,
'comment' => { 'literal' => ["${ical}comment"] } ,
'contact' => { 'resource' => ["${icalx}contact"], 'literal' => ["${ical}contact"] } ,
'dtend' => { 'literal' => ["${ical}dtend"] } ,
'dtstamp' => { 'literal' => ["${ical}dtstamp"] } ,
'dtstart' => { 'literal' => ["${ical}dtstart"] } ,
'duration' => { 'literal' => ["${ical}duration"] } ,
'organizer' => { 'resource' => ["${ical}organizer"], 'literal' => ["${icalx}organizer-literal"] } ,
'summary' => { 'literal' => ["${ical}summary"] } ,
lib/HTML/Microformats/Format/hFreebusy.pm view on Meta::CPAN
sub add_to_model
{
my $self = shift;
my $model = shift;
my $ical = 'http://www.w3.org/2002/12/cal/icaltzd#';
$self->_simple_rdf($model);
foreach my $fb (@{$self->data->{'freebusy'}})
{
$fb->{'_id'} = $self->context->make_bnode
unless defined $fb->{'_id'};
$model->add_statement(RDF::Trine::Statement->new(
$self->id(1),
RDF::Trine::Node::Resource->new("${ical}freebusy"),
RDF::Trine::Node::Blank->new(substr $fb->{'_id'}, 2),
));
$model->add_statement(RDF::Trine::Statement->new(
RDF::Trine::Node::Blank->new(substr $fb->{'_id'}, 2),
RDF::Trine::Node::Resource->new("${ical}fbtype"),
RDF::Trine::Node::Literal->new($fb->{'fbtype'}, undef, 'http://www.w3.org/2001/XMLSchema#string'),
));
foreach my $val (@{$fb->{'value'}})
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
# 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 = ();
foreach my $c (keys %C) { push @containers, $c if $C{$c}; }
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
my $classes = $self->format_signature->{'classes'};
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'],
lib/HTML/Microformats/Mixin/Parser.pm view on Meta::CPAN
{
# 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;
while (length $ancestor->getAttribute('data-cpan-html-microformats-nodepath') > length $root->getAttribute('data-cpan-html-microformats-nodepath'))