| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution OODoc version 3.05. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.05. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2003-2025 by Mark Overmeer. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
9
|
|
|
|
|
|
|
# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package OODoc::Text;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '3.05'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
305445
|
use parent 'OODoc::Object'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
12
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
76
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
62
|
|
|
19
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3
|
use Log::Report 'oodoc'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
3
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#-------------------- |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use overload |
|
26
|
0
|
|
|
0
|
|
|
'""' => sub {$_[0]->name}, |
|
27
|
1
|
|
|
1
|
|
243
|
'cmp' => sub {$_[0]->name cmp "$_[1]"}; |
|
|
1
|
|
|
0
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
|
0
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#-------------------- |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init($) |
|
32
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
|
33
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$self->{OT_name} = delete $args->{name}; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
my $nr = $self->{OT_linenr} = delete $args->{linenr} or panic; |
|
38
|
0
|
0
|
|
|
|
|
$self->{OT_type} = delete $args->{type} or panic; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
exists $args->{container} # may be explicit undef |
|
41
|
0
|
0
|
|
|
|
|
or panic "no text container specified for the ".(ref $self)." object"; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$self->{OT_container}= delete $args->{container}; # may be undef initially |
|
44
|
0
|
|
0
|
|
|
|
$self->{OT_descr} = delete $args->{description} || ''; |
|
45
|
0
|
|
|
|
|
|
$self->{OT_examples} = []; |
|
46
|
0
|
|
|
|
|
|
$self->{OT_extends} = []; |
|
47
|
0
|
|
|
|
|
|
$self; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#-------------------- |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
1
|
|
sub name() { $_[0]->{OT_name} } |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
sub type() { $_[0]->{OT_type} } |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub description() |
|
59
|
0
|
|
|
0
|
1
|
|
{ my @lines = split /^/m, shift->{OT_descr}; |
|
60
|
0
|
|
0
|
|
|
|
shift @lines while @lines && $lines[ 0] =~ m/^\s*$/; |
|
61
|
0
|
|
0
|
|
|
|
pop @lines while @lines && $lines[-1] =~ m/^\s*$/; |
|
62
|
0
|
|
|
|
|
|
join '', @lines; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub container(;$) |
|
67
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
|
68
|
0
|
0
|
|
|
|
|
@_ ? ($self->{OT_container} = shift) : $self->{OT_container}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
1
|
|
sub manual(;$) { $_[0]->container->manual } |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
|
sub linenr() { $_[0]->{OT_linenr} } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub where() |
|
78
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
|
79
|
0
|
|
|
|
|
|
( $self->manual->source, $self->linenr ); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub extends(;$) |
|
84
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
|
85
|
0
|
|
|
|
|
|
my $ext = $self->{OT_extends}; |
|
86
|
0
|
|
|
|
|
|
push @$ext, @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
wantarray ? @$ext : $ext->[0]; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#-------------------- |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
|
sub openDescription() { \($_[0]->{OT_descr}) } |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub findDescriptionObject() |
|
97
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
|
98
|
0
|
0
|
|
|
|
|
return $self if length $self->description; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my @descr = map $_->findDescriptionObject, $self->extends; |
|
101
|
0
|
0
|
|
|
|
|
wantarray ? @descr : $descr[0]; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub addExample($) |
|
106
|
0
|
|
|
0
|
1
|
|
{ my ($self, $example) = @_; |
|
107
|
0
|
|
|
|
|
|
push @{$self->{OT_examples}}, $example; |
|
|
0
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
$example; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
0
|
1
|
|
sub examples() { @{ $_[0]->{OT_examples}} } |
|
|
0
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub publish($%) |
|
115
|
0
|
|
|
0
|
1
|
|
{ my ($self, $args) = @_; |
|
116
|
0
|
0
|
|
|
|
|
my $exporter = $args->{exporter} or panic; |
|
117
|
0
|
0
|
|
|
|
|
my $manual = $args->{manual} or panic; |
|
118
|
0
|
|
|
|
|
|
my $inherited = $manual->inherited($self); |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
my $p = $self->SUPER::publish($args); |
|
121
|
0
|
|
|
|
|
|
$p->{type} = $exporter->markup(lc $self->type); |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
0
|
|
|
|
|
if(my $name = $self->name) |
|
124
|
0
|
|
|
|
|
|
{ $p->{name} = $exporter->markupString($name); |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my $descr; |
|
128
|
0
|
0
|
|
|
|
|
if($inherited) |
|
129
|
|
|
|
|
|
|
{ # This node has nothing extra wrt its base implementation |
|
130
|
0
|
|
|
|
|
|
$descr = 'Inherited, see M<'. $exporter->referTo($manual, $self).'>'; |
|
131
|
0
|
|
|
|
|
|
$p->{extends} = $self->unique; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
else |
|
134
|
0
|
|
0
|
|
|
|
{ $descr = $self->description // ''; |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# Any kind of text can contain examples |
|
137
|
0
|
|
|
|
|
|
my @e = map $_->publish($args)->{id}, $self->examples; |
|
138
|
0
|
0
|
|
|
|
|
$p->{examples} = \@e if @e; |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
0
|
0
|
|
|
|
|
$p->{intro} = $exporter->markupBlock($descr) |
|
142
|
|
|
|
|
|
|
if length $descr; |
|
143
|
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
$p; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
1; |