line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
1790
|
use Stenciller::Standard; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
30
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.1212'; # VERSION: |
4
|
|
|
|
|
|
|
# ABSTRACT: A role for transformer plugins to consume |
5
|
|
|
|
|
|
|
# PODNAME: Stenciller::Transformer |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
12304
|
role Stenciller::Transformer using Moose { |
|
4
|
|
|
4
|
|
95
|
|
|
4
|
|
|
4
|
|
20
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
204
|
|
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
35
|
|
|
4
|
|
|
|
|
1037
|
|
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
232
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
193
|
|
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
318
|
|
|
4
|
|
|
|
|
116
|
|
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
41
|
|
|
4
|
|
|
|
|
14910
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
17544
|
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
33
|
|
|
4
|
|
|
|
|
9826
|
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
40
|
|
|
4
|
|
|
|
|
317
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
63
|
|
|
4
|
|
|
|
|
786
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
35
|
|
|
4
|
|
|
|
|
3843
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
35
|
|
|
4
|
|
|
|
|
14797
|
|
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
155
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
135
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
190
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
483
|
|
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
13335
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
|
|
46
|
requires 'transform'; |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
|
|
1249
|
has stenciller => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => Stenciller, |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
4
|
50
|
|
4
|
|
41304
|
method init_out(Stenciller $stenciller, HashRef $transform_args) { |
|
4
|
50
|
|
4
|
|
7
|
|
|
4
|
50
|
|
4
|
|
518
|
|
|
4
|
50
|
|
4
|
|
18
|
|
|
4
|
50
|
|
|
|
6
|
|
|
4
|
50
|
|
|
|
403
|
|
|
4
|
50
|
|
|
|
18
|
|
|
4
|
50
|
|
|
|
7
|
|
|
4
|
|
|
|
|
428
|
|
|
4
|
|
|
|
|
912
|
|
|
4
|
|
|
|
|
45
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
23
|
|
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
7
|
|
18
|
4
|
|
|
|
|
13
|
my @out = (''); |
19
|
4
|
50
|
|
|
|
153
|
push (@out => $stenciller->all_header_lines, '') if !$transform_args->{'skip_header_lines'}; |
20
|
4
|
|
|
|
|
52
|
return @out; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
4
|
50
|
33
|
4
|
|
10039
|
method should_skip_stencil_by_index(Int $index, HashRef $transform_args) { |
|
4
|
50
|
|
4
|
|
7
|
|
|
4
|
50
|
|
4
|
|
460
|
|
|
4
|
50
|
|
8
|
|
23
|
|
|
4
|
50
|
|
|
|
5
|
|
|
4
|
50
|
|
|
|
554
|
|
|
4
|
50
|
|
|
|
18
|
|
|
4
|
50
|
|
|
|
6
|
|
|
4
|
|
|
|
|
548
|
|
|
4
|
|
|
|
|
813
|
|
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
53
|
|
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
7
|
|
24
|
8
|
100
|
100
|
11
|
|
35
|
return 1 if exists $transform_args->{'stencils'} && -1 == first_index { $_ == $index } @{ $transform_args->{'stencils'} }; |
|
11
|
|
|
|
|
41
|
|
|
6
|
|
|
|
|
17
|
|
25
|
6
|
|
|
|
|
22
|
return 0; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
4
|
50
|
|
4
|
|
10047
|
method should_skip_stencil(Stencil $stencil, HashRef $transform_args) { |
|
4
|
50
|
|
4
|
|
8
|
|
|
4
|
50
|
|
4
|
|
498
|
|
|
4
|
50
|
|
6
|
|
16
|
|
|
4
|
50
|
|
|
|
7
|
|
|
4
|
50
|
|
|
|
447
|
|
|
4
|
50
|
|
|
|
18
|
|
|
4
|
50
|
|
|
|
5
|
|
|
4
|
|
|
|
|
607
|
|
|
4
|
|
|
|
|
516
|
|
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
7
|
|
29
|
6
|
100
|
|
|
|
44
|
return 0 if !exists $transform_args->{'require_in_extra'}; |
30
|
3
|
|
|
|
|
4
|
my $wanted_key = $transform_args->{'require_in_extra'}{'key'}; |
31
|
3
|
|
|
|
|
4
|
my $required_value = $transform_args->{'require_in_extra'}{'value'}; |
32
|
3
|
|
|
|
|
4
|
my $default_value = $transform_args->{'require_in_extra'}{'default'}; |
33
|
|
|
|
|
|
|
|
34
|
3
|
100
|
|
|
|
94
|
return !$default_value if !defined $stencil->get_extra_setting($wanted_key); |
35
|
2
|
|
|
|
|
72
|
return !$stencil->get_extra_setting($wanted_key); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=encoding UTF-8 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Stenciller::Transformer - A role for transformer plugins to consume |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 VERSION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Version 0.1212, released 2015-02-10. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
package Stenciller::Plugin::MyNewRenderer; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use Moose; |
62
|
|
|
|
|
|
|
with 'Stenciller::Transformer'; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub transformer { |
65
|
|
|
|
|
|
|
... |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is the role that all L<Stenciller> plugins must consume. It requires a C<transformer> method to be implemented. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 transform |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This method must be implemented by classes consuming this role. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
It takes one attribute: |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
B<C<$transform_args>> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
C<$transform_args> is a hash reference with the following structure: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$transform_args => { |
85
|
|
|
|
|
|
|
skip_header_lines => 0|1, |
86
|
|
|
|
|
|
|
stencils => [...], |
87
|
|
|
|
|
|
|
require_in_extra => { |
88
|
|
|
|
|
|
|
key => '...', |
89
|
|
|
|
|
|
|
value => '...', |
90
|
|
|
|
|
|
|
default => '...', |
91
|
|
|
|
|
|
|
}, |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
B<C<skip_header_lines =E<gt> 1>> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
C<skip_header_lines> takes a boolean indicating if the L<Stenciller's|Stenciller> header_lines should be skipped. Default is C<0>. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
B<C<stencils =E<gt> [ ]>> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
C<stencils> takes an array reference of which stencils in the currently parsed file that should be included in the output. The index is zero based. If C<stencils> is not given, all stencils are parsed. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
B<C<require_in_extra =E<gt> { }>> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
C<require_in_extra> allows finer filtering than C<stencils>. Usually, the point to using Stenciller, and |
105
|
|
|
|
|
|
|
related modules, is to use the same content more than once (eg. include it in pod, create html files with |
106
|
|
|
|
|
|
|
examples, and create tests). It is not always necessary to include every stencil in every end product. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
If C<require_in_extra> is given, it looks in the options hash for every stencil for the C<key> key. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over 4 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
If C<key> exists in the stencil's hash, and it has the C<value> value, then the stencil is parsed. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
If C<key> exists in the stencil's hash, and it doesn't have the C<value> value, then the stencil is not parsed. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
If C<key> doesn't exist in the stencil's hash, then the two first rules are applied as if the stencil had the C<default> value. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=back |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 stenciller |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The L<Stenciller> object is passed automatically to plugins. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SOURCE |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Stenciller> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 HOMEPAGE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
L<https://metacpan.org/release/Stenciller> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
149
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |