| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
3
|
|
|
3
|
|
2359
|
use 5.14.0; |
|
|
3
|
|
|
|
|
13
|
|
|
2
|
3
|
|
|
3
|
|
17
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
94
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
228
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Stenciller::Plugin::ToUnparsedText; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1302'; # VERSION: |
|
8
|
|
|
|
|
|
|
# ABSTRACT: A plugin that doesn't transform the text |
|
9
|
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
18
|
use Moose; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
29
|
|
|
11
|
3
|
|
|
3
|
|
24572
|
use List::AllUtils qw/first_index/; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
299
|
|
|
12
|
|
|
|
|
|
|
with 'Stenciller::Transformer'; |
|
13
|
3
|
|
|
3
|
|
21
|
use Types::Standard qw/Bool/; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
63
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has text_as_html_pod => ( |
|
16
|
|
|
|
|
|
|
is => 'ro', |
|
17
|
|
|
|
|
|
|
isa => Bool, |
|
18
|
|
|
|
|
|
|
default => 0, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub transform { |
|
23
|
4
|
|
|
4
|
1
|
3272
|
my $self = shift; |
|
24
|
4
|
|
|
|
|
10
|
my $transform_args = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
138
|
my @out = $self->init_out($self->stenciller, $transform_args); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
STENCIL: |
|
29
|
4
|
|
|
|
|
138
|
for my $i (0 .. $self->stenciller->max_stencil_index) { |
|
30
|
10
|
100
|
|
|
|
72
|
next STENCIL if $self->should_skip_stencil_by_index($i, $transform_args); |
|
31
|
|
|
|
|
|
|
|
|
32
|
4
|
|
|
|
|
175
|
my $stencil = $self->stenciller->get_stencil($i); |
|
33
|
4
|
50
|
|
|
|
225
|
next STENCIL if $self->should_skip_stencil($stencil, $transform_args); |
|
34
|
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
263
|
push @out => '', |
|
36
|
|
|
|
|
|
|
$self->maybe_as_html_pod($stencil->all_before_input), '', |
|
37
|
|
|
|
|
|
|
$stencil->all_input, '', |
|
38
|
|
|
|
|
|
|
$self->maybe_as_html_pod($stencil->all_between), '', |
|
39
|
|
|
|
|
|
|
$stencil->all_output, '', |
|
40
|
|
|
|
|
|
|
$self->maybe_as_html_pod($stencil->all_after_output), ''; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
4
|
|
|
|
|
27
|
my $content = join "\n" => '', @out, ''; |
|
43
|
4
|
|
|
|
|
53
|
$content =~ s{\v{2,}}{\n\n}g; |
|
44
|
4
|
|
|
|
|
112
|
return $content; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub maybe_as_html_pod { |
|
48
|
12
|
|
|
12
|
0
|
508
|
my $self = shift; |
|
49
|
12
|
|
|
|
|
28
|
my @text = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
12
|
100
|
|
|
|
497
|
return @text if !$self->text_as_html_pod; |
|
52
|
3
|
100
|
|
|
|
34
|
return @text if !scalar @text; |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
7
|
unshift @text => '', '=begin html', ''; |
|
55
|
2
|
|
|
|
|
4
|
push @text => '', '=end html', ''; |
|
56
|
2
|
|
|
|
|
96
|
return @text; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=encoding UTF-8 |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 NAME |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Stenciller::Plugin::ToUnparsedText - A plugin that doesn't transform the text |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 VERSION |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Version 0.1302, released 2015-11-28. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
use Stenciller; |
|
81
|
|
|
|
|
|
|
my $stenciller = Stenciller->new(filepath => 't/corpus/test-1.stencil'); |
|
82
|
|
|
|
|
|
|
my $content = $stenciller->transform('ToUnparsedText'); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This plugin to L<Stenciller> basically returns all text content of the stencils. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
If this plugin is used via L<Pod::Elemental::Transformer::Stenciller> it could be used like this in pod: |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=pod |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# includes header_lines and all stencils |
|
93
|
|
|
|
|
|
|
:stenciller ToUnparsedText atestfile-1.stencil |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# includes header_lines and all stencils |
|
96
|
|
|
|
|
|
|
:stenciller ToUnparsedText atestfile-1.stencil { } |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# includes only the first stencil in the file |
|
99
|
|
|
|
|
|
|
:stenciller ToUnparsedText atestfile-1.stencil { stencils => [0], skip_header_lines => 1 } |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# includes only the header_lines |
|
102
|
|
|
|
|
|
|
:stenciller ToUnparsedText atestfile-1.stencil { stencils => [] } |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 text_as_html_pod |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Default: 0 |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
If set to a true value, the parts that are neither C<input> or C<output> will be rendered between C<=begin html> and C<=end html>. This is useful |
|
111
|
|
|
|
|
|
|
when rendering the same stencils to html examples files as well as including in pod. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 METHODS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 transform |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
See L<transform|Stenciller::Transformer/"transform"> in L<Stenciller::Transformer>. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SOURCE |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Stenciller> |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<https://metacpan.org/release/Stenciller> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Erik Carlsson. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
136
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |