line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Elemental::Paragraph; |
2
|
|
|
|
|
|
|
# ABSTRACT: a paragraph in a Pod document |
3
|
|
|
|
|
|
|
$Pod::Elemental::Paragraph::VERSION = '0.103005'; |
4
|
15
|
|
|
15
|
|
8702
|
use namespace::autoclean; |
|
15
|
|
|
|
|
37
|
|
|
15
|
|
|
|
|
133
|
|
5
|
15
|
|
|
15
|
|
994
|
use Moose::Role; |
|
15
|
|
|
|
|
39
|
|
|
15
|
|
|
|
|
93
|
|
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
84673
|
use Encode qw(encode); |
|
15
|
|
|
|
|
155797
|
|
|
15
|
|
|
|
|
1140
|
|
8
|
15
|
|
|
15
|
|
6596
|
use String::Truncate qw(elide); |
|
15
|
|
|
|
|
65161
|
|
|
15
|
|
|
|
|
100
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod This is probably the most important role in the Pod-Elemental distribution. |
13
|
|
|
|
|
|
|
#pod Classes including this role represent paragraphs in a Pod document. The |
14
|
|
|
|
|
|
|
#pod paragraph is the fundamental unit of dividing up Pod documents, so this is a |
15
|
|
|
|
|
|
|
#pod often-included role. |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod =attr content |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod This is the textual content of the element, as in a Pod::Eventual event. In |
20
|
|
|
|
|
|
|
#pod other words, this Pod: |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod =head2 content |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod has a content of "content\n" |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =attr start_line |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod This attribute, which may or may not be set, indicates the line in the source |
29
|
|
|
|
|
|
|
#pod document where the element began. |
30
|
|
|
|
|
|
|
#pod |
31
|
|
|
|
|
|
|
#pod =cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has content => (is => 'rw', isa => 'Str', required => 1); |
34
|
|
|
|
|
|
|
has start_line => (is => 'ro', isa => 'Int', required => 0); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#pod =method as_pod_string |
37
|
|
|
|
|
|
|
#pod |
38
|
|
|
|
|
|
|
#pod This returns the element as a string, suitable for turning elements back into |
39
|
|
|
|
|
|
|
#pod a document. Some elements, like a C<=over> command, will stringify to include |
40
|
|
|
|
|
|
|
#pod extra content like a C<=back> command. In the case of elements with children, |
41
|
|
|
|
|
|
|
#pod this method will include the stringified children as well. |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod =cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub as_pod_string { |
46
|
37
|
|
|
37
|
1
|
103
|
my ($self) = @_; |
47
|
37
|
|
|
|
|
1118
|
return $self->content; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#pod =method as_debug_string |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod This method returns a string, like C<as_string>, but is meant for getting an |
53
|
|
|
|
|
|
|
#pod overview of the document structure, and is not suitable for reproducing a |
54
|
|
|
|
|
|
|
#pod document. Its exact output is likely to change over time. |
55
|
|
|
|
|
|
|
#pod |
56
|
|
|
|
|
|
|
#pod =cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _summarize_string { |
59
|
0
|
|
|
0
|
|
|
my ($self, $str, $length) = @_; |
60
|
0
|
|
0
|
|
|
|
$length ||= 30; |
61
|
|
|
|
|
|
|
|
62
|
15
|
|
|
15
|
|
14018
|
use utf8; |
|
15
|
|
|
|
|
254
|
|
|
15
|
|
|
|
|
87
|
|
63
|
0
|
|
|
|
|
|
chomp $str; |
64
|
0
|
|
|
|
|
|
my $elided = elide($str, $length, { truncate => 'middle', marker => 'â¦' }); |
65
|
15
|
|
|
15
|
|
1335
|
$elided =~ tr/\n\t/â¤â/; |
|
15
|
|
|
|
|
52
|
|
|
15
|
|
|
|
|
200
|
|
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return encode('utf-8', $elided); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
requires 'as_debug_string'; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=encoding UTF-8 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Pod::Elemental::Paragraph - a paragraph in a Pod document |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 0.103005 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 OVERVIEW |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is probably the most important role in the Pod-Elemental distribution. |
91
|
|
|
|
|
|
|
Classes including this role represent paragraphs in a Pod document. The |
92
|
|
|
|
|
|
|
paragraph is the fundamental unit of dividing up Pod documents, so this is a |
93
|
|
|
|
|
|
|
often-included role. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 content |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is the textual content of the element, as in a Pod::Eventual event. In |
100
|
|
|
|
|
|
|
other words, this Pod: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 content |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
has a content of "content\n" |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 start_line |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This attribute, which may or may not be set, indicates the line in the source |
109
|
|
|
|
|
|
|
document where the element began. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 METHODS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 as_pod_string |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This returns the element as a string, suitable for turning elements back into |
116
|
|
|
|
|
|
|
a document. Some elements, like a C<=over> command, will stringify to include |
117
|
|
|
|
|
|
|
extra content like a C<=back> command. In the case of elements with children, |
118
|
|
|
|
|
|
|
this method will include the stringified children as well. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 as_debug_string |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This method returns a string, like C<as_string>, but is meant for getting an |
123
|
|
|
|
|
|
|
overview of the document structure, and is not suitable for reproducing a |
124
|
|
|
|
|
|
|
document. Its exact output is likely to change over time. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Ricardo SIGNES <rjbs@cpan.org> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Ricardo SIGNES. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
135
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |