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