line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1059
|
use 5.10.1; |
|
2
|
|
|
|
|
8
|
|
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
42
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
125
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Pod::Elemental::Transformer::Splint::AttributeRenderer::HtmlDefault; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Default html attribute renderer |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.1202'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
22
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
12
|
2
|
|
|
2
|
|
14794
|
use namespace::autoclean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
13
|
2
|
|
|
2
|
|
175
|
use Path::Tiny; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
143
|
|
14
|
2
|
|
|
2
|
|
22
|
use Pod::Simple::XHTML; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
85
|
|
15
|
2
|
|
|
2
|
|
985
|
use syntax 'qs'; |
|
2
|
|
|
|
|
2832
|
|
|
2
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
with 'Pod::Elemental::Transformer::Splint::AttributeRenderer'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub render_attribute { |
20
|
2
|
|
|
2
|
0
|
5
|
my $self = shift; |
21
|
2
|
|
|
|
|
3
|
my $data = shift; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
4
|
my $settings = $data->{'settings'}; |
24
|
2
|
|
|
|
|
4
|
my $documentation_alts = $data->{'documentation_alts'}; |
25
|
2
|
|
|
|
|
5
|
my $documentation = $data->{'documentation'}; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
4
|
my $items = []; |
28
|
2
|
50
|
|
|
|
10
|
push @$items => $settings->{'type'} if defined $settings->{'type'}; |
29
|
2
|
|
|
|
|
5
|
my $req_and_default = ''; |
30
|
|
|
|
|
|
|
|
31
|
2
|
50
|
|
|
|
12
|
if(!$settings->{'has_init_arg'}) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
$req_and_default = 'not in constructor'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
elsif(!defined $settings->{'default'}) { |
35
|
2
|
|
|
|
|
5
|
$req_and_default = $settings->{'required_text'}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif($settings->{'is_default_a_coderef'}) { |
38
|
0
|
0
|
|
|
|
0
|
if(defined $settings->{'documentation_default'}) { |
39
|
0
|
|
|
|
|
0
|
$req_and_default = $self->parse_pod(sprintf '%s, default: C<%s>', $settings->{'required_text'}, $settings->{'documentation_default'}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
|
|
|
|
0
|
$req_and_default = $self->parse_pod(sprintf '%s, default is a C<coderef>', $settings->{'required_text'}); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
0
|
|
|
|
|
0
|
$req_and_default = $self->parse_pod(sprintf '%s, default: C<%s>', $settings->{'required_text'}, $settings->{'default'}); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
5
|
push @$items => $req_and_default; |
50
|
2
|
|
|
|
|
5
|
push @$items => $settings->{'is_text'}; |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
4
|
my $last_item = pop @$items; |
53
|
2
|
|
|
|
|
5
|
my $cells = [ map { $self->make_cell_with_border(nowrap => 1, text => $_) } @$items ]; |
|
4
|
|
|
|
|
11
|
|
54
|
|
|
|
|
|
|
|
55
|
2
|
50
|
|
|
|
5
|
push @$cells => scalar @{ $documentation_alts } ? $self->make_cell_with_border(nowrap => 1, text => $last_item) |
|
2
|
|
|
|
|
9
|
|
56
|
|
|
|
|
|
|
: $self->make_cell_without_border(nowrap => 1, text => $last_item) |
57
|
|
|
|
|
|
|
; |
58
|
|
|
|
|
|
|
|
59
|
2
|
50
|
|
|
|
4
|
if(scalar @{ $documentation_alts }) { |
|
2
|
|
|
|
|
8
|
|
60
|
2
|
|
|
|
|
3
|
my $first_doc_alt = shift @{ $documentation_alts }; |
|
2
|
|
|
|
|
4
|
|
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
14
|
push @$cells => $self->make_cell_without_border_right_aligned(nowrap => 0, text => $self->parse_pod(sprintf 'C<%s>:', $first_doc_alt->[0]) ), |
63
|
|
|
|
|
|
|
$self->make_cell_extra_padded_without_border(nowrap => 0, text => $first_doc_alt->[1]); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
|
|
7
|
my $rows = [ $cells ]; |
67
|
|
|
|
|
|
|
|
68
|
2
|
100
|
|
|
|
3
|
if(scalar @{ $documentation_alts} ){ |
|
2
|
|
|
|
|
9
|
|
69
|
1
|
|
|
|
|
5
|
my $number_of_cells_left_of_doc = scalar @$cells - 2; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
2
|
foreach my $doc_alt (@{ $documentation_alts }) { |
|
1
|
|
|
|
|
4
|
|
72
|
1
|
|
|
|
|
4
|
my $row = [ (' <td> </td>') x $number_of_cells_left_of_doc ]; |
73
|
1
|
|
|
|
|
2
|
push @{ $row } => $self->make_cell_without_border_right_aligned(nowrap => 0, text => $self->parse_pod(sprintf 'C<%s>:', $doc_alt->[0]) ), |
|
1
|
|
|
|
|
9
|
|
74
|
|
|
|
|
|
|
$self->make_cell_extra_padded_without_border(nowrap => 0, text => $doc_alt->[1]); |
75
|
1
|
|
|
|
|
5
|
push @{ $rows } => $row; |
|
1
|
|
|
|
|
6
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
2
|
|
|
|
|
3
|
my @table = (); |
80
|
2
|
|
|
|
|
5
|
foreach my $row (@{ $rows }) { |
|
2
|
|
|
|
|
5
|
|
81
|
3
|
|
|
|
|
6
|
push @table => ('<tr>'); |
82
|
3
|
|
|
|
|
5
|
push @table => @{ $row }; |
|
3
|
|
|
|
|
8
|
|
83
|
3
|
|
|
|
|
7
|
push @table => ('</tr>'); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
50
|
|
|
9
|
my $content = sprintf qs{ |
87
|
|
|
|
|
|
|
=begin %s |
88
|
2
|
|
|
|
|
38
|
|
89
|
|
|
|
|
|
|
<table cellpadding="0" cellspacing="0"> |
90
|
|
|
|
|
|
|
%s |
91
|
|
|
|
|
|
|
</table> |
92
|
0
|
|
|
0
|
0
|
0
|
|
93
|
0
|
|
|
|
|
0
|
<p>%s</p> |
94
|
0
|
|
|
|
|
0
|
|
95
|
0
|
0
|
|
|
|
0
|
=end %s |
96
|
|
|
|
|
|
|
}, $self->for, join ("\n" => @table), ($documentation // ''), $self->for; |
97
|
0
|
|
|
|
|
0
|
|
98
|
|
|
|
|
|
|
return $content; |
99
|
|
|
|
|
|
|
} |
100
|
3
|
|
|
3
|
0
|
7
|
|
101
|
3
|
|
|
|
|
8
|
sub make_cell_without_border { |
102
|
3
|
|
|
|
|
5
|
my $self = shift; |
103
|
3
|
50
|
|
|
|
8
|
my %args = @_; |
104
|
|
|
|
|
|
|
my $text = $args{'text'}; |
105
|
3
|
|
|
|
|
14
|
my $nowrap = !$args{'nowrap'} ? '' : ' white-space: nowrap;'; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
return qq{ <td style="padding-left: 6px; padding-right: 6px;$nowrap">$text</td>}; |
108
|
6
|
|
|
6
|
0
|
9
|
} |
109
|
6
|
|
|
|
|
26
|
sub make_cell_extra_padded_without_border { |
110
|
6
|
|
|
|
|
15
|
my $self = shift; |
111
|
6
|
50
|
|
|
|
14
|
my %args = @_; |
112
|
|
|
|
|
|
|
my $text = $args{'text'}; |
113
|
6
|
|
|
|
|
25
|
my $nowrap = !$args{'nowrap'} ? '' : ' white-space: nowrap;'; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
return qq{ <td style="padding-left: 12px;$nowrap">$text</td>}; |
116
|
3
|
|
|
3
|
0
|
7
|
} |
117
|
3
|
|
|
|
|
11
|
sub make_cell_with_border { |
118
|
3
|
|
|
|
|
6
|
my $self = shift; |
119
|
3
|
50
|
|
|
|
10
|
my %args = @_; |
120
|
|
|
|
|
|
|
my $text = $args{'text'}; |
121
|
3
|
|
|
|
|
20
|
my $nowrap = !$args{'nowrap'} ? '' : ' white-space: nowrap;'; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
return qq{ <td style="padding-right: 6px; padding-left: 6px; border-right: 1px solid #b8b8b8;$nowrap">$text</td>}; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
sub make_cell_without_border_right_aligned { |
126
|
|
|
|
|
|
|
my $self = shift; |
127
|
|
|
|
|
|
|
my %args = @_; |
128
|
|
|
|
|
|
|
my $text = $args{'text'}; |
129
|
|
|
|
|
|
|
my $nowrap = !$args{'nowrap'} ? '' : ' white-space: nowrap;'; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
return qq{ <td style="text-align: right; padding-right: 6px; padding-left: 6px;$nowrap">$text</td>}; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
__END__ |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=pod |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=encoding UTF-8 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 NAME |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Pod::Elemental::Transformer::Splint::AttributeRenderer::HtmlDefault - Default html attribute renderer |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 VERSION |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Version 0.1202, released 2020-12-26. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 SOURCE |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Pod-Elemental-Transformer-Splint> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 HOMEPAGE |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<https://metacpan.org/release/Pod-Elemental-Transformer-Splint> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 AUTHOR |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Erik Carlsson. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
169
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |