File: example1.pl

package info (click to toggle)
librdf-icalendar-perl 0.005-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220 kB
  • sloc: perl: 856; makefile: 2
file content (122 lines) | stat: -rw-r--r-- 4,281 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
use HTML::Microformats;
use RDF::TrineX::Functions -shortcuts;
use RDF::iCalendar::Exporter;

my $hcalendar = <<'HTML';

	<div class="hentry" id="fooble">
		<span class="entry-title">Foo</span>
		<span class="published updated">2011-02-02</span>
	</div>
	
	<div class="vfreebusy">
		<b class="summary">I'm busy some times</b>
		<i class="freebusy">
			<u class="fbtype">busy</u>
			<b class="value">19980415T133000Z/19980415T170000Z</b>
			<b class="value">19990415T133000Z/19990415T170000Z</b>
		</i>
	</div>

  <div class="vevent">
    <h1 class="uid" id="xmas">
      <span class="summary">Christmas</span> Schedule
    </h1>
    <abbr class="dtstart" title="0001-12-25" style="display:none"></abbr>
    <p class="comment rrule"><span class="freq">Yearly</span>
    period of festive merriment.</p>
    <div class="attendee vcard">
      <b class="role">
        <abbr title="REQ-PARTICIPANT">Required for merriment:</abbr>
      </b><br>
      <span class="fn">
        <span class="honorific-prefix nickname">Santa</span>
        <span class="given-name">Claus</span>
      </span>
      (<span class="adr><span class="region">North Pole</span></span>)
    </div>
	 <p class="location geo">12;34</p>
  </div>
  
    <div class="vtodo">
      <h2 class="uid" id="shopping">Shopping</h2>
      <abbr class="dtstart" title="2008-12-01">In December</abbr>, don't forget
      to <span class="summary">buy everyone their presents</span> before the
      shops shut on <abbr class="due" title="2008-12-24T16:00:00">Christmas
      Eve</abbr>!
      <a class="attach" rel="enclosure" href="data:,Perl%20is%20good">attachment</a>
		<div class="valarm">
			<span class="summary">Reminder!</span>
			<span class="trigger">-PT12H</span>
		</div>
    </div>
    
    <div class="vevent">
      <h2 id="jones" class="uid summary">Jones' Christmas Lunch</h2>
      <p class="comment">The Joneses have been having a wonderful lunch 
      <abbr class="rrule" title="FREQ=YEARLY">every year</abbr> at
      <abbr class="dtstart" title="2003-12-25T13:00:00Z">1pm for the last
      few years</abbr>.</p>
      <p><span class="attendee">Everyone</span>'s invited.</p>
      <i class="category">Foo</i>
      <i class="category">Bar</i>
      <i class="category">Baz</i>
      <a rel="tag" href="/tag/Foo">Foo</a>
		<div class="location vcard">
			 <p class="adr">
				<span class="fn extended-address">Jones Household</span>
				<span class="locality">Lewes</span>
				<span class="region">East Sussex</span>
			 </p>
		 </div>
    </div>
  
  <div class="vevent">
    <h2 class="summary">Boxing Day</h2>
    <p class="comment">
      <abbr class="rrule" title="FREQ=YEARLY">Every year</abbr>
      <abbr class="dtstart" title="0001-12-26">the day after</abbr>
      <a class="related-to" href="#xmas" rel="vcalendar-sibling">Christmas</a>
      is Boxing Day. Nobody knows quite why this day is called that.
    </p>
	 <p class="contact organizer attendee vcard">
		<a class="fn email" href="mailto:alice@example.net">Alice Jones</a>
		<span class="role">required</span>
		<span class="sent-by vcard">
			<a class="fn email" href="mailto:bob@example.net">Bob Jones</a>
		</span>
	 </p>
	 <p class="location adr">
		<span class="locality">Lewes</span>
		<span class="region">East Sussex</span>
	 </p>
  </div>
  
  <div class="vevent">
  <p>Our organisation has been offering a series of <span class="summary"
  >summer lectures</span> since
  <abbr class="dtstart" title="19970105T083000">January 1997</abbr>. They
are
  <span class="rrule">
    held <span class="freq">yearly</span>,
    every <span class="interval">2</span>nd year (1999, 2001, etc),
    every <span class="byday">Sunday</span>
    in January <abbr class="bymonth" title="1" style="display:none"></abbr>
    at <span class="byhour">8</span>:<span class="byminute">30</span> and
    repeated at <span class="byhour">9</span>:30.
  </span>
</p>
</div>

HTML

my $doc = HTML::Microformats->new_document($hcalendar, 'http://hcal.example.net/')->assume_all_profiles;
my @objects = $doc->objects('hCalendar');
print $objects[0]->to_icalendar;

#print rdf_string($doc->model =>'RDFXML');
#print "========\n";
#my @cals = RDF::iCalendar::Exporter->new->export_calendars($doc->model);
#print "========\n";
#print $_ foreach @cals ;