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