line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MojoX::CustomTemplateFileParser::Plugin::To::Pod; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5103
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
14
|
use 5.10.1; |
|
1
|
|
|
|
|
3
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1002'; # VERSION |
8
|
|
|
|
|
|
|
# ABSTRACT: Create pod |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub to_pod { |
13
|
1
|
|
|
1
|
1
|
10683
|
my $self = shift; |
14
|
1
|
|
|
|
|
3
|
my $test_index = shift; |
15
|
1
|
|
50
|
|
|
9
|
my $want_all_examples = shift || 0; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
49
|
my $tests_at_index = $self->test_index->{ $test_index }; |
18
|
1
|
|
|
|
|
3
|
my @out = (); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
TEST: |
21
|
1
|
|
|
|
|
3
|
foreach my $test (@{ $tests_at_index }) { |
|
1
|
|
|
|
|
3
|
|
22
|
1
|
50
|
33
|
|
|
4
|
next TEST if $want_all_examples && !$test->{'is_example'}; |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
2
|
if(scalar @{ $test->{'lines_before'} }) { |
|
1
|
|
|
|
|
5
|
|
25
|
|
|
|
|
|
|
push @out => "\n", '=begin html', "\n", |
26
|
1
|
|
|
|
|
2
|
'<p>', @{ $test->{'lines_before'} }, '</p>', |
|
1
|
|
|
|
|
6
|
|
27
|
|
|
|
|
|
|
"\n", '=end html', |
28
|
|
|
|
|
|
|
"\n"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
1
|
push @out => @{ $test->{'lines_template'} }, "\n"; |
|
1
|
|
|
|
|
6
|
|
32
|
1
|
50
|
|
|
|
2
|
if(scalar @{ $test->{'lines_between'} }) { |
|
1
|
|
|
|
|
4
|
|
33
|
|
|
|
|
|
|
push @out => '=begin html', "\n", |
34
|
1
|
|
|
|
|
3
|
'<p>',@{ $test->{'lines_between'} }, '</p>', |
|
1
|
|
|
|
|
4
|
|
35
|
|
|
|
|
|
|
"\n", '=end html', |
36
|
|
|
|
|
|
|
"\n"; |
37
|
|
|
|
|
|
|
} |
38
|
1
|
|
|
|
|
3
|
push @out => @{ $test->{'lines_expected' } }, "\n"; |
|
1
|
|
|
|
|
4
|
|
39
|
1
|
50
|
|
|
|
2
|
if(scalar @{ $test->{'lines_after'} }) { |
|
1
|
|
|
|
|
3
|
|
40
|
|
|
|
|
|
|
push @out => '=begin html', "\n", |
41
|
1
|
|
|
|
|
2
|
'<p>',@{ $test->{'lines_after'} }, '</p>', |
|
1
|
|
|
|
|
5
|
|
42
|
|
|
|
|
|
|
"\n", '=end html', "\n"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
17
|
my $out = join "\n" => @out; |
47
|
1
|
|
|
|
|
15
|
$out =~ s{\n\n\n+}{\n\n}g; |
48
|
1
|
|
|
|
|
11
|
$out =~ s{\n+=begin html\n+}{\n\n=begin html\n\n}g; |
49
|
1
|
|
|
|
|
9
|
$out =~ s{\n+=end html\n+}{\n\n=end html\n\n}g; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
9
|
return $out; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=encoding UTF-8 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
MojoX::CustomTemplateFileParser::Plugin::To::Pod - Create pod |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 VERSION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Version 0.1002, released 2015-11-26. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SYNOPSIS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use MojoX::CustomTemplateFileParser; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $parser = MojoX::CustomTemplateFileParser->new(path => '/path/to/file.mojo', output => ['Pod']); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
print $parser->to_pod; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 DESCRIPTION |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
MojoX::CustomTemplateFileParser::Plugin::To::Pod is an output plugin to L<MojoX::CustomTemplateFileParser>. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 to_pod() |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This method is added to L<MojoX::CustomTemplateFileParser> objects created with C<output =E<gt> ['Pod']>. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SEE ALSO |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
* L<Dist::Zilla::Plugin::InsertExample::FromMojoTemplates> |
96
|
|
|
|
|
|
|
* L<MojoX::CustomTemplateFileParser::Plugin::To::Pod> |
97
|
|
|
|
|
|
|
* L<MojoX::CustomTemplateFileParser::Plugin::To::Test> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SOURCE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-mojox-customtemplatefileparser> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 HOMEPAGE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L<https://metacpan.org/release/MojoX-CustomTemplateFileParser> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Erik Carlsson. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |