line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
require 5; |
3
|
|
|
|
|
|
|
package Pod::PseudoPod::Text; |
4
|
1
|
|
|
1
|
|
2072
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION $FREAKYMODE ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
178
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.18'; |
8
|
1
|
|
|
1
|
|
7
|
use base qw( Pod::PseudoPod ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
488
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
26833
|
use Text::Wrap 98.112902 (); |
|
1
|
|
|
|
|
3489
|
|
|
1
|
|
|
|
|
1758
|
|
11
|
|
|
|
|
|
|
$Text::Wrap::wrap = 'overflow'; |
12
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
26
|
|
|
26
|
1
|
41844
|
my $self = shift; |
16
|
26
|
|
|
|
|
138
|
my $new = $self->SUPER::new(@_); |
17
|
26
|
|
50
|
|
|
182
|
$new->{'output_fh'} ||= *STDOUT{IO}; |
18
|
26
|
|
|
|
|
111
|
$new->accept_target_as_text(qw( text plaintext plain )); |
19
|
26
|
|
|
|
|
1125
|
$new->accept_targets_as_text( qw(author blockquote comment caution |
20
|
|
|
|
|
|
|
editor epigraph example figure important listing note production |
21
|
|
|
|
|
|
|
programlisting screen sidebar table tip warning) ); |
22
|
|
|
|
|
|
|
|
23
|
26
|
|
|
|
|
1981
|
$new->nix_X_codes(1); |
24
|
26
|
|
|
|
|
301
|
$new->nix_Z_codes(1); |
25
|
26
|
|
|
|
|
85
|
$new->nbsp_for_S(1); |
26
|
26
|
|
|
|
|
219
|
$new->codes_in_verbatim(1); |
27
|
26
|
|
|
|
|
202
|
$new->{'scratch'} = ''; |
28
|
26
|
|
|
|
|
52
|
$new->{'Indent'} = 0; |
29
|
26
|
|
|
|
|
44
|
$new->{'Indentstring'} = ' '; |
30
|
26
|
|
|
|
|
170
|
return $new; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
34
|
|
|
|
|
|
|
|
35
|
47
|
|
|
47
|
0
|
179
|
sub handle_text { $_[0]{'scratch'} .= $_[1] } |
36
|
|
|
|
|
|
|
|
37
|
16
|
|
|
16
|
0
|
58
|
sub start_Para { $_[0]{'scratch'} = '' } |
38
|
16
|
|
|
16
|
0
|
47
|
sub end_Para { $_[0]->emit(0) } |
39
|
1
|
|
|
1
|
0
|
4
|
sub start_Verbatim { $_[0]{'scratch'} = '' } |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
0
|
5
|
sub start_head0 { $_[0]{'scratch'} = '' } |
42
|
1
|
|
|
1
|
0
|
9
|
sub end_head0 { $_[0]->emit(-4) } |
43
|
1
|
|
|
1
|
0
|
5
|
sub start_head1 { $_[0]{'scratch'} = '' } |
44
|
1
|
|
|
1
|
0
|
6
|
sub end_head1 { $_[0]->emit(-3) } |
45
|
2
|
|
|
2
|
0
|
9
|
sub start_head2 { $_[0]{'scratch'} = '' } |
46
|
2
|
|
|
2
|
0
|
11
|
sub end_head2 { $_[0]->emit(-2) } |
47
|
1
|
|
|
1
|
0
|
6
|
sub start_head3 { $_[0]{'scratch'} = '' } |
48
|
1
|
|
|
1
|
0
|
5
|
sub end_head3 { $_[0]->emit(-1) } |
49
|
1
|
|
|
1
|
0
|
4
|
sub start_head4 { $_[0]{'scratch'} = '' } |
50
|
1
|
|
|
1
|
0
|
4
|
sub end_head4 { $_[0]->emit(0) } |
51
|
|
|
|
|
|
|
|
52
|
2
|
50
|
|
2
|
0
|
11
|
sub start_item_bullet { $_[0]{'scratch'} = $FREAKYMODE ? '' : '* ' } |
53
|
2
|
|
|
2
|
0
|
8
|
sub end_item_bullet { $_[0]->emit( 0) } |
54
|
2
|
50
|
|
2
|
0
|
14
|
sub start_item_number { $_[0]{'scratch'} = $FREAKYMODE ? '' : "$_[1]{'number'}. " } |
55
|
2
|
|
|
2
|
0
|
6
|
sub end_item_number { $_[0]->emit( 0) } |
56
|
2
|
|
|
2
|
0
|
7
|
sub start_item_text { $_[0]{'scratch'} = '' } |
57
|
2
|
|
|
2
|
0
|
8
|
sub end_item_text { $_[0]->emit(-2) } |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
1
|
0
|
5
|
sub start_over_bullet { ++$_[0]{'Indent'} } |
60
|
1
|
|
|
1
|
0
|
12
|
sub end_over_bullet { --$_[0]{'Indent'} } |
61
|
1
|
|
|
1
|
0
|
4
|
sub start_over_number { ++$_[0]{'Indent'} } |
62
|
1
|
|
|
1
|
0
|
12
|
sub end_over_number { --$_[0]{'Indent'} } |
63
|
1
|
|
|
1
|
0
|
4
|
sub start_over_text { ++$_[0]{'Indent'} } |
64
|
1
|
|
|
1
|
0
|
12
|
sub end_over_text { --$_[0]{'Indent'} } |
65
|
0
|
|
|
0
|
0
|
0
|
sub start_over_block { ++$_[0]{'Indent'} } |
66
|
0
|
|
|
0
|
0
|
0
|
sub end_over_block { --$_[0]{'Indent'} } |
67
|
|
|
|
|
|
|
|
68
|
3
|
|
|
3
|
0
|
10
|
sub start_for { ++$_[0]{'Indent'} } |
69
|
3
|
|
|
3
|
0
|
8
|
sub end_for { $_[0]->emit(); --$_[0]{'Indent'} } |
|
3
|
|
|
|
|
10
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub start_sidebar { |
72
|
1
|
|
|
1
|
0
|
2
|
my ($self, $flags) = @_; |
73
|
1
|
|
|
|
|
3
|
$self->{'scratch'} = ''; |
74
|
1
|
50
|
|
|
|
3
|
if ($flags->{'title'}) { |
75
|
1
|
|
|
|
|
3
|
$self->{'scratch'} .= "Sidebar: " . $flags->{'title'} . "\n"; |
76
|
|
|
|
|
|
|
} |
77
|
1
|
|
|
|
|
2
|
++$self->{'Indent'}; |
78
|
1
|
|
|
|
|
3
|
$self->emit(); |
79
|
|
|
|
|
|
|
} |
80
|
1
|
|
|
1
|
0
|
5
|
sub end_sidebar { $_[0]->emit(); --$_[0]{'Indent'} } |
|
1
|
|
|
|
|
3
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub start_table { |
83
|
4
|
|
|
4
|
0
|
10
|
my ($self, $flags) = @_; |
84
|
4
|
|
|
|
|
9
|
$self->{'scratch'} = ''; |
85
|
4
|
100
|
|
|
|
11
|
if ($flags->{'title'}) { |
86
|
1
|
|
|
|
|
89
|
$self->{'scratch'} .= "Table: " . $flags->{'title'} . "\n"; |
87
|
|
|
|
|
|
|
} |
88
|
4
|
|
|
|
|
12
|
++$self->{'Indent'}; |
89
|
|
|
|
|
|
|
} |
90
|
4
|
|
|
4
|
0
|
12
|
sub end_table { --$_[0]{'Indent'} } |
91
|
|
|
|
|
|
|
|
92
|
10
|
|
|
10
|
0
|
32
|
sub end_cell { $_[0]{'scratch'} .= " | "; } |
93
|
5
|
|
|
5
|
0
|
14
|
sub end_row { $_[0]->emit() } |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
1
|
0
|
4
|
sub start_N { $_[0]{'scratch'} .= ' [footnote: '; } |
96
|
1
|
|
|
1
|
0
|
4
|
sub end_N { $_[0]{'scratch'} .= ']'; } |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub emit { |
99
|
38
|
|
|
38
|
0
|
77
|
my($self, $tweak_indent) = splice(@_,0,2); |
100
|
38
|
|
100
|
|
|
417
|
my $indent = ' ' x ( 2 * $self->{'Indent'} + 4 + ($tweak_indent||0) ); |
101
|
|
|
|
|
|
|
# Yes, 'STRING' x NEGATIVE gives '', same as 'STRING' x 0 |
102
|
|
|
|
|
|
|
|
103
|
38
|
|
|
|
|
80
|
$self->{'scratch'} =~ tr{\xAD}{}d if Pod::Simple::ASCII; |
104
|
38
|
|
|
|
|
88
|
my $out = $self->{'scratch'} . "\n"; |
105
|
38
|
|
|
|
|
159
|
$out = Text::Wrap::wrap($indent, $indent, $out); |
106
|
38
|
|
|
|
|
11326
|
$out =~ tr{\xA0}{ } if Pod::Simple::ASCII; |
107
|
38
|
|
|
|
|
56
|
print {$self->{'output_fh'}} $out, "\n"; |
|
38
|
|
|
|
|
195
|
|
108
|
38
|
|
|
|
|
373
|
$self->{'scratch'} = ''; |
109
|
|
|
|
|
|
|
|
110
|
38
|
|
|
|
|
123
|
return; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# . . . . . . . . . . And then off by its lonesome: |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub end_Verbatim { |
116
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
117
|
1
|
|
|
|
|
2
|
if(Pod::Simple::ASCII) { |
118
|
1
|
|
|
|
|
2
|
$self->{'scratch'} =~ tr{\xA0}{ }; |
119
|
1
|
|
|
|
|
3
|
$self->{'scratch'} =~ tr{\xAD}{}d; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
1
|
|
|
|
|
5
|
my $i = ' ' x ( 2 * $self->{'Indent'} + 4); |
123
|
|
|
|
|
|
|
#my $i = ' ' x (4 + $self->{'Indent'}); |
124
|
|
|
|
|
|
|
|
125
|
1
|
|
|
|
|
6
|
$self->{'scratch'} =~ s/^/$i/mg; |
126
|
|
|
|
|
|
|
|
127
|
1
|
|
|
|
|
2
|
print { $self->{'output_fh'} } '', |
|
1
|
|
|
|
|
6
|
|
128
|
|
|
|
|
|
|
$self->{'scratch'}, |
129
|
|
|
|
|
|
|
"\n\n" |
130
|
|
|
|
|
|
|
; |
131
|
1
|
|
|
|
|
11
|
$self->{'scratch'} = ''; |
132
|
1
|
|
|
|
|
4
|
return; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 NAME |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Pod::PseudoPod::Text -- format PseudoPod as plaintext |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 SYNOPSIS |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
perl -MPod::PseudoPod::Text -e \ |
148
|
|
|
|
|
|
|
"exit Pod::PseudoPod::Text->filter(shift)->any_errata_seen" \ |
149
|
|
|
|
|
|
|
thingy.pod |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 DESCRIPTION |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This class is a formatter that takes PseudoPod and renders it as |
154
|
|
|
|
|
|
|
wrapped plaintext. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Its wrapping is done by L<Text::Wrap>, so you can change |
157
|
|
|
|
|
|
|
C<$Text::Wrap::columns> as you like. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This is a subclass of L<Pod::PseudoPod> and inherits all its methods. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 SEE ALSO |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L<Pod::Simple>, L<Pod::Simple::TextContent>, L<Pod::Text> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Copyright (c) 2002-2004 Sean M. Burke and Allison Randal. All rights |
168
|
|
|
|
|
|
|
reserved. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
171
|
|
|
|
|
|
|
it under the same terms as Perl itself. The full text of the license |
172
|
|
|
|
|
|
|
can be found in the LICENSE file included with this module. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but |
175
|
|
|
|
|
|
|
without any warranty; without even the implied warranty of |
176
|
|
|
|
|
|
|
merchantability or fitness for a particular purpose. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 AUTHOR |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Sean M. Burke C<sburke@cpan.org> & |
181
|
|
|
|
|
|
|
Allison Randal <allison@perl.org> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|