line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Weaver::Plugin::EnsurePod5; |
2
|
|
|
|
|
|
|
# ABSTRACT: ensure that the Pod5 translator has been run on this document |
3
|
|
|
|
|
|
|
$Pod::Weaver::Plugin::EnsurePod5::VERSION = '4.017'; |
4
|
9
|
|
|
9
|
|
6503
|
use Moose; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
with 'Pod::Weaver::Role::Preparer'; |
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
63741
|
use namespace::autoclean; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
89
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
747
|
use Pod::Elemental::Transformer::Pod5; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
3195
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This plugin is very, very simple: it runs the Pod5 transformer on the input |
14
|
|
|
|
|
|
|
#pod document and removes any leftover whitespace-only Nonpod elements. If |
15
|
|
|
|
|
|
|
#pod non-whitespace-only Nonpod elements are found, an exception is raised. |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod =cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _strip_nonpod { |
20
|
53
|
|
|
53
|
|
553
|
my ($self, $node) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# XXX: This is really stupid. -- rjbs, 2009-10-24 |
23
|
|
|
|
|
|
|
|
24
|
53
|
|
|
|
|
128
|
foreach my $i (reverse 0 .. $#{ $node->children }) { |
|
53
|
|
|
|
|
1521
|
|
25
|
337
|
|
|
|
|
31465
|
my $para = $node->children->[$i]; |
26
|
|
|
|
|
|
|
|
27
|
337
|
50
|
|
|
|
3513
|
if ($para->isa('Pod::Elemental::Element::Pod5::Nonpod')) { |
|
|
100
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
0
|
if ($para->content !~ /\S/) { |
29
|
0
|
|
|
|
|
0
|
splice @{ $node->children }, $i, 1 |
|
0
|
|
|
|
|
0
|
|
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
|
|
|
|
0
|
confess "can't cope with a Nonpod element with non-whitespace content"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} elsif ($para->does('Pod::Elemental::Node')) { |
34
|
24
|
|
|
|
|
5184
|
$self->_strip_nonpod($para); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub prepare_input { |
40
|
29
|
|
|
29
|
0
|
110
|
my ($self, $input) = @_; |
41
|
29
|
|
|
|
|
96
|
my $pod_document = $input->{pod_document}; |
42
|
|
|
|
|
|
|
|
43
|
29
|
|
|
|
|
1329
|
Pod::Elemental::Transformer::Pod5->new->transform_node($pod_document); |
44
|
|
|
|
|
|
|
|
45
|
29
|
|
|
|
|
284568
|
$self->_strip_nonpod($pod_document); |
46
|
|
|
|
|
|
|
|
47
|
29
|
|
|
|
|
1455
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=encoding UTF-8 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Pod::Weaver::Plugin::EnsurePod5 - ensure that the Pod5 translator has been run on this document |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 4.017 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 OVERVIEW |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This plugin is very, very simple: it runs the Pod5 transformer on the input |
70
|
|
|
|
|
|
|
document and removes any leftover whitespace-only Nonpod elements. If |
71
|
|
|
|
|
|
|
non-whitespace-only Nonpod elements are found, an exception is raised. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Ricardo SIGNES <rjbs@cpan.org> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Ricardo SIGNES. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
82
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |