line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
RDF::RDFa::Generator::HTML::Pretty::Note - a note about something |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=cut |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package RDF::RDFa::Generator::HTML::Pretty::Note; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
68
|
use 5.008; |
|
4
|
|
|
|
|
14
|
|
10
|
4
|
|
|
4
|
|
40
|
use strict; |
|
4
|
|
|
|
|
26
|
|
|
4
|
|
|
|
|
196
|
|
11
|
4
|
|
|
4
|
|
29
|
use constant XHTML_NS => 'http://www.w3.org/1999/xhtml'; |
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
276
|
|
12
|
4
|
|
|
4
|
|
27
|
use XML::LibXML qw':all'; |
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
40
|
|
13
|
4
|
|
|
4
|
|
751
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
386
|
|
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
28
|
use warnings; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
1111
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.200'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Often you'll want to create your own subclass of this as the basic notes are pretty |
23
|
|
|
|
|
|
|
limited (plain text only). |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 Constructor |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=over 4 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item C<< $note = RDF::RDFa::Generator::HTML::Pretty::Note->new($subject, $text) >> |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$subject is an RDF::Trine::Node (though probably not a Literal!) indicating the |
32
|
|
|
|
|
|
|
subject of the note. $text is the plain text content of the note. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=back |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
1
|
19908
|
my ($class, $subject, $text) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
9
|
return bless { |
43
|
|
|
|
|
|
|
'subject' => $subject, |
44
|
|
|
|
|
|
|
'text' => $text, |
45
|
|
|
|
|
|
|
}, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 Public Methods |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C<< $note->is_relevant_to($node) >> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$node is an L<RDF::Trine::Node> or L<Attean> IRI or blank. Checks if the subject of $note is $node. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Alias: is_relevent_to. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub is_relevant_to |
61
|
|
|
|
|
|
|
{ |
62
|
2
|
|
|
2
|
1
|
7
|
my ($self, $something) = @_; |
63
|
2
|
|
|
|
|
11
|
return $self->{'subject'}->equals($something); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
*is_relevent_to = \&is_relevant_to; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item C<< $note->node($namespace, $tagname) >> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Gets an XML::LibXML::Element representing the note. $namespace and $tagname |
71
|
|
|
|
|
|
|
are used to create the new element. If an unexpected namespace or tagname is |
72
|
|
|
|
|
|
|
supplied, may die. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Expected namespace is 'http://www.w3.org/1999/xhtml'. Expected tagname is any XHTML |
75
|
|
|
|
|
|
|
tag that can contain text nodes. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub node |
82
|
|
|
|
|
|
|
{ |
83
|
1
|
|
|
1
|
1
|
5
|
my ($self, $namespace, $element) = @_; |
84
|
1
|
50
|
|
|
|
7
|
croak "unknown namespace" unless $namespace eq XHTML_NS; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
5
|
my $node = XML::LibXML::Element->new($element); |
87
|
1
|
|
|
|
|
5
|
$node->setNamespace($namespace, undef, 1); |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
29
|
$node->appendTextNode($self->{'text'}); |
90
|
|
|
|
|
|
|
|
91
|
1
|
|
|
|
|
14
|
return $node; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<RDF::RDFa::Generator>, |
102
|
|
|
|
|
|
|
L<RDF::RDFa::Linter>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Copyright (C) 2010 by Toby Inkster |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
113
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8 or, |
114
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|