| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# A quite dimwitted pod2plaintext that need only know how to format whatever |
|
3
|
|
|
|
|
|
|
# text comes out of Pod::BlackBox's _gen_errata |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Pod::PseudoPod::Checker; |
|
6
|
1
|
|
|
1
|
|
1411
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
55
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.18'; |
|
9
|
1
|
|
|
1
|
|
6
|
use Carp (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
15
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw( Pod::PseudoPod ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
352
|
|
|
11
|
|
|
|
|
|
|
BEGIN { *DEBUG = defined(&Pod::PseudoPod::DEBUG) |
|
12
|
|
|
|
|
|
|
? \&Pod::PseudoPod::DEBUG |
|
13
|
|
|
|
|
|
|
: sub() {0} |
|
14
|
1
|
50
|
|
1
|
|
25
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1001
|
use Text::Wrap 98.112902 (); # was 2001.0131, but I don't think we need that |
|
|
1
|
|
|
|
|
3149
|
|
|
|
1
|
|
|
|
|
1080
|
|
|
17
|
|
|
|
|
|
|
$Text::Wrap::wrap = 'overflow'; |
|
18
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub any_errata_seen { # read-only accessor |
|
21
|
0
|
|
|
0
|
1
|
0
|
return $_[1]->{'Errata_seen'}; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
|
25
|
2
|
|
|
2
|
1
|
1163
|
my $self = shift; |
|
26
|
2
|
|
|
|
|
13
|
my $new = $self->SUPER::new(@_); |
|
27
|
2
|
|
50
|
|
|
22
|
$new->{'output_fh'} ||= *STDOUT{IO}; |
|
28
|
2
|
|
|
|
|
12
|
$new->accept_targets_as_text( qw(author blockquote comment caution |
|
29
|
|
|
|
|
|
|
editor epigraph example figure important note production |
|
30
|
|
|
|
|
|
|
programlisting screen sidebar table tip warning) ); |
|
31
|
2
|
|
|
|
|
152
|
$new->nix_X_codes(1); |
|
32
|
2
|
|
|
|
|
20
|
$new->nbsp_for_S(1); |
|
33
|
2
|
|
|
|
|
11
|
$new->{'scratch'} = ''; |
|
34
|
2
|
|
|
|
|
4
|
$new->{'Indent'} = 0; |
|
35
|
2
|
|
|
|
|
4
|
$new->{'Indentstring'} = ' '; |
|
36
|
2
|
|
|
|
|
3
|
$new->{'Errata_seen'} = 0; |
|
37
|
2
|
|
|
|
|
5
|
return $new; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
41
|
|
|
|
|
|
|
|
|
42
|
6
|
100
|
|
6
|
0
|
26
|
sub handle_text { $_[0]{'Errata_seen'} and $_[0]{'scratch'} .= $_[1] } |
|
43
|
|
|
|
|
|
|
|
|
44
|
3
|
|
|
3
|
0
|
10
|
sub start_Para { $_[0]{'scratch'} = '' } |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub start_head1 { |
|
47
|
1
|
50
|
|
1
|
0
|
5
|
if($_[0]{'Errata_seen'}) { |
|
48
|
0
|
|
|
|
|
0
|
$_[0]{'scratch'} = ''; |
|
49
|
|
|
|
|
|
|
} else { |
|
50
|
1
|
50
|
|
|
|
13
|
if($_[1]{'errata'}) { # start of errata! |
|
51
|
1
|
|
|
|
|
3
|
$_[0]{'Errata_seen'} = 1; |
|
52
|
1
|
50
|
|
|
|
5
|
$_[0]{'scratch'} = $_[0]{'source_filename'} ? |
|
53
|
|
|
|
|
|
|
"$_[0]{'source_filename'} -- " : '' |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
|
|
0
|
0
|
0
|
sub start_head2 { $_[0]{'scratch'} = '' } |
|
58
|
0
|
|
|
0
|
0
|
0
|
sub start_head3 { $_[0]{'scratch'} = '' } |
|
59
|
0
|
|
|
0
|
0
|
0
|
sub start_head4 { $_[0]{'scratch'} = '' } |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
0
|
0
|
sub start_Verbatim { $_[0]{'scratch'} = '' } |
|
62
|
0
|
|
|
0
|
0
|
0
|
sub start_item_bullet { $_[0]{'scratch'} = '* ' } |
|
63
|
0
|
|
|
0
|
0
|
0
|
sub start_item_number { $_[0]{'scratch'} = "$_[1]{'number'}. " } |
|
64
|
1
|
|
|
1
|
0
|
3
|
sub start_item_text { $_[0]{'scratch'} = '' } |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
0
|
0
|
sub start_over_bullet { ++$_[0]{'Indent'} } |
|
67
|
0
|
|
|
0
|
0
|
0
|
sub start_over_number { ++$_[0]{'Indent'} } |
|
68
|
1
|
|
|
1
|
0
|
4
|
sub start_over_text { ++$_[0]{'Indent'} } |
|
69
|
0
|
|
|
0
|
0
|
0
|
sub start_over_block { ++$_[0]{'Indent'} } |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
0
|
0
|
sub end_over_bullet { --$_[0]{'Indent'} } |
|
72
|
0
|
|
|
0
|
0
|
0
|
sub end_over_number { --$_[0]{'Indent'} } |
|
73
|
1
|
|
|
1
|
0
|
9
|
sub end_over_text { --$_[0]{'Indent'} } |
|
74
|
0
|
|
|
0
|
0
|
0
|
sub end_over_block { --$_[0]{'Indent'} } |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# . . . . . Now the actual formatters: |
|
78
|
|
|
|
|
|
|
|
|
79
|
1
|
|
|
1
|
0
|
4
|
sub end_head1 { $_[0]->emit(-4) } |
|
80
|
0
|
|
|
0
|
0
|
0
|
sub end_head2 { $_[0]->emit(-3) } |
|
81
|
0
|
|
|
0
|
0
|
0
|
sub end_head3 { $_[0]->emit(-2) } |
|
82
|
0
|
|
|
0
|
0
|
0
|
sub end_head4 { $_[0]->emit(-1) } |
|
83
|
3
|
|
|
3
|
0
|
9
|
sub end_Para { $_[0]->emit( 0) } |
|
84
|
0
|
|
|
0
|
0
|
0
|
sub end_item_bullet { $_[0]->emit( 0) } |
|
85
|
0
|
|
|
0
|
0
|
0
|
sub end_item_number { $_[0]->emit( 0) } |
|
86
|
1
|
|
|
1
|
0
|
4
|
sub end_item_text { $_[0]->emit(-2) } |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub emit { |
|
89
|
5
|
100
|
|
5
|
0
|
13
|
return unless $_[0]{'Errata_seen'}; |
|
90
|
4
|
|
|
|
|
7
|
my($self, $tweak_indent) = splice(@_,0,2); |
|
91
|
4
|
|
100
|
|
|
18
|
my $indent = ' ' x ( 2 * $self->{'Indent'} + ($tweak_indent||0) ); |
|
92
|
|
|
|
|
|
|
# Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 |
|
93
|
|
|
|
|
|
|
|
|
94
|
4
|
|
|
|
|
8
|
$self->{'scratch'} =~ tr{\xAD}{}d if Pod::Simple::ASCII; |
|
95
|
4
|
|
|
|
|
18
|
my $out = Text::Wrap::wrap($indent, $indent, $self->{'scratch'} .= "\n"); |
|
96
|
4
|
|
|
|
|
687
|
$out =~ tr{\xA0}{ } if Pod::Simple::ASCII; |
|
97
|
4
|
|
|
|
|
5
|
print {$self->{'output_fh'}} $out, |
|
|
4
|
|
|
|
|
19
|
|
|
98
|
|
|
|
|
|
|
; |
|
99
|
4
|
|
|
|
|
140
|
$self->{'scratch'} = ''; |
|
100
|
|
|
|
|
|
|
|
|
101
|
4
|
|
|
|
|
12
|
return; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# . . . . . . . . . . And then off by its lonesome: |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub end_Verbatim { |
|
107
|
0
|
0
|
|
0
|
0
|
0
|
return unless $_[0]{'Errata_seen'}; |
|
108
|
0
|
|
|
|
|
0
|
my $self = shift; |
|
109
|
0
|
|
|
|
|
0
|
if(Pod::Simple::ASCII) { |
|
110
|
0
|
|
|
|
|
0
|
$self->{'scratch'} =~ tr{\xA0}{ }; |
|
111
|
0
|
|
|
|
|
0
|
$self->{'scratch'} =~ tr{\xAD}{}d; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
0
|
my $i = ' ' x ( 2 * $self->{'Indent'} + 4); |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
$self->{'scratch'} =~ s/^/$i/mg; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
0
|
print { $self->{'output_fh'} } '', |
|
|
0
|
|
|
|
|
0
|
|
|
119
|
|
|
|
|
|
|
$self->{'scratch'}, |
|
120
|
|
|
|
|
|
|
"\n\n" |
|
121
|
|
|
|
|
|
|
; |
|
122
|
0
|
|
|
|
|
0
|
$self->{'scratch'} = ''; |
|
123
|
0
|
|
|
|
|
0
|
return; |
|
124
|
|
|
|
|
|
|
} |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub end_Document { |
|
127
|
1
|
|
|
1
|
0
|
2
|
my ($self) = @_; |
|
128
|
1
|
50
|
|
|
|
9
|
return if $self->{'Errata_seen'}; |
|
129
|
0
|
|
|
|
|
|
print { $self->{'output_fh'} } "\tNo errors seen!\n"; |
|
|
0
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
133
|
|
|
|
|
|
|
1; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__END__ |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 NAME |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Pod::PseudoPod::Checker -- check the PseudoPod syntax of a document |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
use Pod::PseudoPod::Checker; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
my $checker = Pod::PseudoPod::Checker->new(); |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
... |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
$checker->parse_file('path/to/file.pod'); |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This class is for checking the syntactic validity of Pod. |
|
154
|
|
|
|
|
|
|
It works by basically acting like a simple-minded version of |
|
155
|
|
|
|
|
|
|
L<Pod::PseudoPod::Text> that formats only the "Pod Errors" section |
|
156
|
|
|
|
|
|
|
(if Pod::PseudoPod even generates one for the given document). |
|
157
|
|
|
|
|
|
|
It's largely unchanged from L<Pod::Simple::Checker>. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
L<Pod::PseudoPod>, L<Pod::PseudoPod::Text>, L<Pod::Checker> |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Copyright (c) 2002-2004 Sean M. Burke and Allison Randal. All rights |
|
166
|
|
|
|
|
|
|
reserved. |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
|
169
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
|
172
|
|
|
|
|
|
|
without any warranty; without even the implied warranty of |
|
173
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Sean M. Burke C<sburke@cpan.org> and |
|
178
|
|
|
|
|
|
|
Allison Randal <allison@perl.org> |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
|
181
|
|
|
|
|
|
|
|