| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# $Id$ |
|
2
|
|
|
|
|
|
|
package Pod::InDesign::TaggedText::TPR; |
|
3
|
3
|
|
|
3
|
|
26141
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
135
|
|
|
4
|
3
|
|
|
3
|
|
21
|
use base 'Pod::InDesign::TaggedText'; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
5223
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
252067
|
use warnings; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
91
|
|
|
7
|
3
|
|
|
3
|
|
16
|
no warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
101
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
15
|
use subs qw(); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
53
|
|
|
10
|
3
|
|
|
3
|
|
14
|
use vars qw($VERSION); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
6946
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '0.10'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Pod::InDesign::TaggedText - Turn Pod into Tagged Text for The Perl Review |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Pod::InDesign::TaggedText::TPR; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
***THIS IS ALPHA SOFTWARE. MAJOR PARTS WILL CHANGE*** |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module overrides and extends C to translate |
|
27
|
|
|
|
|
|
|
Pod into the InDesign Tagged Text format used by The Perl Review. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub document_header |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
3
|
|
|
3
|
1
|
43
|
<<'HTML'; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
> |
|
36
|
|
|
|
|
|
|
> |
|
37
|
|
|
|
|
|
|
> |
|
38
|
|
|
|
|
|
|
> |
|
39
|
|
|
|
|
|
|
> |
|
40
|
|
|
|
|
|
|
> |
|
41
|
|
|
|
|
|
|
>>> |
|
42
|
|
|
|
|
|
|
> |
|
43
|
|
|
|
|
|
|
> |
|
44
|
|
|
|
|
|
|
> |
|
45
|
|
|
|
|
|
|
> |
|
46
|
|
|
|
|
|
|
> |
|
47
|
|
|
|
|
|
|
> |
|
48
|
|
|
|
|
|
|
> |
|
49
|
|
|
|
|
|
|
> |
|
50
|
|
|
|
|
|
|
> |
|
51
|
|
|
|
|
|
|
> |
|
52
|
|
|
|
|
|
|
> |
|
53
|
|
|
|
|
|
|
> |
|
54
|
|
|
|
|
|
|
> |
|
55
|
|
|
|
|
|
|
> |
|
56
|
|
|
|
|
|
|
> |
|
57
|
|
|
|
|
|
|
> |
|
58
|
|
|
|
|
|
|
>>> |
|
59
|
|
|
|
|
|
|
>>> |
|
60
|
|
|
|
|
|
|
> |
|
61
|
|
|
|
|
|
|
> |
|
62
|
|
|
|
|
|
|
HTML |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
3
|
|
|
3
|
1
|
27
|
sub head1_style { 'Feature Section' } |
|
66
|
0
|
|
|
0
|
1
|
0
|
sub head2_style { 'Feature Sub Section' } |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub normal_para_style |
|
69
|
|
|
|
|
|
|
{ |
|
70
|
|
|
|
|
|
|
# The paragraph style depends on which para it is. The very first para |
|
71
|
|
|
|
|
|
|
# has a drop cap. The first para after a section title has no initial |
|
72
|
|
|
|
|
|
|
# indent. All other paras have an initial indent. |
|
73
|
5
|
|
50
|
5
|
0
|
47
|
my $last_thing = $_[0]{last_thingy} || 'para'; |
|
74
|
|
|
|
|
|
|
|
|
75
|
5
|
50
|
|
|
|
32
|
if( $last_thing eq 'para' ) { 'Feature Para' } #indent |
|
|
0
|
100
|
|
|
|
0
|
|
|
|
|
50
|
|
|
|
|
|
|
76
|
3
|
|
|
|
|
20
|
elsif( $last_thing eq 'head1' ) { 'Feature Section Lead' } # no indent |
|
77
|
0
|
|
|
|
|
0
|
elsif( $last_thing eq 'start' ) { 'Feature Lead' } # has drop cap |
|
78
|
2
|
|
|
|
|
25
|
else { 'Feature Para' } |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
1
|
|
|
1
|
0
|
2
|
sub code_para_style { 'Feature Code Para' } |
|
82
|
|
|
|
|
|
|
|
|
83
|
1
|
|
|
1
|
1
|
132
|
sub inline_code_style { 'pod-C' } |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
0
|
1
|
0
|
sub inline_url_style { 'pod-I' } |
|
86
|
|
|
|
|
|
|
|
|
87
|
2
|
|
|
2
|
1
|
459
|
sub inline_italic_style { 'pod-I' } |
|
88
|
|
|
|
|
|
|
|
|
89
|
1
|
|
|
1
|
1
|
281
|
sub inline_bold_style { 'pod-B' } |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub start_Document |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
3
|
|
|
3
|
0
|
26088
|
my $self = shift; |
|
94
|
|
|
|
|
|
|
|
|
95
|
3
|
|
|
|
|
33
|
$self->SUPER::start_Document; |
|
96
|
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
583
|
$self->{last_thingy} = 'start'; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub start_head1 |
|
101
|
|
|
|
|
|
|
{ |
|
102
|
3
|
|
|
3
|
0
|
1134
|
my $self = shift; |
|
103
|
|
|
|
|
|
|
|
|
104
|
3
|
|
|
|
|
115
|
$self->SUPER::start_head1; |
|
105
|
|
|
|
|
|
|
|
|
106
|
3
|
|
|
|
|
12
|
$self->{scratch} .= 'n '; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub end_head1 |
|
110
|
|
|
|
|
|
|
{ |
|
111
|
3
|
|
|
3
|
0
|
200
|
my $self = shift; |
|
112
|
|
|
|
|
|
|
|
|
113
|
3
|
|
|
|
|
10
|
$self->{scratch} .= "\t"; # right tab to get ----- to right margin |
|
114
|
3
|
|
|
|
|
8
|
$self->{last_thingy} = 'head1'; |
|
115
|
|
|
|
|
|
|
|
|
116
|
3
|
|
|
|
|
25
|
$self->SUPER::end_head1; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub start_Para |
|
120
|
|
|
|
|
|
|
{ |
|
121
|
5
|
|
|
5
|
0
|
13075
|
my $self = shift; |
|
122
|
|
|
|
|
|
|
|
|
123
|
5
|
|
|
|
|
34
|
$self->SUPER::start_Para; |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# psb must be after the start of the para. Go figure. |
|
126
|
5
|
100
|
|
|
|
34
|
$self->{scratch} .= '' |
|
127
|
|
|
|
|
|
|
if $self->{last_thingy} eq 'bullet_list'; |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
|
130
|
5
|
|
|
|
|
17
|
$self->{last_thingy} = 'para'; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
3
|
|
|
3
|
1
|
5697
|
sub new { $_[0]->SUPER::new() } |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub end_Verbatim |
|
136
|
|
|
|
|
|
|
{ |
|
137
|
1
|
|
|
1
|
0
|
418
|
my @lines = split m/^/m, $_[0]{'scratch'}; |
|
138
|
|
|
|
|
|
|
|
|
139
|
1
|
|
|
|
|
3
|
my $first = shift @lines; |
|
140
|
1
|
|
|
|
|
2
|
my $last = shift @lines; |
|
141
|
|
|
|
|
|
|
|
|
142
|
1
|
|
|
|
|
4
|
$_[0]{'scratch'} =~ s/\n+\z/\n/; |
|
143
|
|
|
|
|
|
|
|
|
144
|
1
|
|
|
|
|
5
|
my $style = $_[0]->code_para_style; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# the pSpaceBefore comes after the on the first line |
|
147
|
|
|
|
|
|
|
# so add it before I add the to the front of every |
|
148
|
|
|
|
|
|
|
# line |
|
149
|
1
|
|
|
|
|
4
|
$_[0]{'scratch'} =~ s/^//; |
|
150
|
|
|
|
|
|
|
|
|
151
|
1
|
|
|
|
|
10
|
$_[0]{'scratch'} =~ s/^//gm; |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# after the first line, I need to reset , so |
|
154
|
|
|
|
|
|
|
# find the position of the first newline and shove it in |
|
155
|
|
|
|
|
|
|
# right after it. There's a special case where the code line |
|
156
|
|
|
|
|
|
|
# is a single line (so, no newline in scratch). |
|
157
|
1
|
|
|
|
|
5
|
my $first_newline_pos = index( $_[0]{'scratch'}, "\n" ); |
|
158
|
|
|
|
|
|
|
|
|
159
|
1
|
50
|
|
|
|
6
|
if( $first_newline_pos == -1 ) |
|
160
|
|
|
|
|
|
|
{ |
|
161
|
0
|
|
|
|
|
0
|
$first_newline_pos = length( $_[0]{'scratch'} ) - 1; |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
#print STDERR "first_newline_pos is $first_newline_pos\n"; |
|
165
|
|
|
|
|
|
|
#print STDERR "length of scratch is " . length( $_[0]{'scratch'} ) . "\n"; |
|
166
|
|
|
|
|
|
|
|
|
167
|
1
|
|
|
|
|
5
|
substr( $_[0]{'scratch'}, $first_newline_pos + 1, 0 ) = ''; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
# right after the last I need to specify the space after |
|
171
|
|
|
|
|
|
|
# that line. Heh, this might be the first time I've used rindex |
|
172
|
|
|
|
|
|
|
# for anything useful. |
|
173
|
1
|
|
|
|
|
3
|
my $substr_len = length ""; |
|
174
|
|
|
|
|
|
|
|
|
175
|
1
|
|
|
|
|
4
|
my $last_para_pos = rindex( $_[0]{'scratch'}, "" ); |
|
176
|
1
|
|
|
|
|
2
|
substr( $_[0]{'scratch'}, $last_para_pos + $substr_len, 0 ) |
|
177
|
|
|
|
|
|
|
= ''; |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# the really comes before the next normal para, but |
|
181
|
|
|
|
|
|
|
# I only need it after a verbatim block, so just attach it at the end |
|
182
|
|
|
|
|
|
|
# of this instead of the beginning of the next thing. Alternatively, |
|
183
|
|
|
|
|
|
|
# I could look at last_thingy in normal_para_style, but that's a bit |
|
184
|
|
|
|
|
|
|
# more pain. |
|
185
|
1
|
|
|
|
|
3
|
$_[0]{'scratch'} .= "\n"; |
|
186
|
|
|
|
|
|
|
|
|
187
|
1
|
|
|
|
|
4
|
$_[0]->emit(); |
|
188
|
|
|
|
|
|
|
|
|
189
|
1
|
|
|
|
|
13
|
$_[0]->{last_thingy} = 'verbatim'; |
|
190
|
1
|
|
|
|
|
4
|
$_[0]{'in_verbatim'} = 0; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub _get_initial_item_type |
|
194
|
|
|
|
|
|
|
{ |
|
195
|
1
|
|
|
1
|
|
673
|
my $self = shift; |
|
196
|
|
|
|
|
|
|
|
|
197
|
1
|
|
|
|
|
10
|
my $type = $self->SUPER::_get_initial_item_type; |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
#print STDERR "My item type is [$type]\n"; |
|
200
|
|
|
|
|
|
|
|
|
201
|
1
|
|
|
|
|
38
|
$type; |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub start_item_bullet |
|
205
|
|
|
|
|
|
|
{ |
|
206
|
3
|
|
|
3
|
0
|
1064
|
my $self = shift; |
|
207
|
|
|
|
|
|
|
|
|
208
|
3
|
100
|
|
|
|
13
|
my $end_last = |
|
209
|
|
|
|
|
|
|
$self->{bullet_count}++ ? |
|
210
|
|
|
|
|
|
|
'' |
|
211
|
|
|
|
|
|
|
: |
|
212
|
|
|
|
|
|
|
''; |
|
213
|
|
|
|
|
|
|
|
|
214
|
3
|
|
|
|
|
10
|
$self->{'scratch'} .= <<"HERE"; |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
$end_last |
|
217
|
|
|
|
|
|
|
HERE |
|
218
|
|
|
|
|
|
|
|
|
219
|
3
|
|
|
|
|
11
|
chomp $self->{'scratch'}; |
|
220
|
|
|
|
|
|
|
|
|
221
|
3
|
|
|
|
|
21
|
$self->emit; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
|
|
224
|
0
|
|
|
0
|
0
|
0
|
sub start_item_number { } |
|
225
|
0
|
|
|
0
|
0
|
0
|
sub start_item_text { } |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub start_over_bullet |
|
228
|
|
|
|
|
|
|
{ |
|
229
|
1
|
|
|
1
|
0
|
33
|
my $self = shift; |
|
230
|
|
|
|
|
|
|
|
|
231
|
1
|
|
|
|
|
2
|
$self->{in_bullet_list} = 1; |
|
232
|
1
|
|
|
|
|
4
|
$self->{bullet_count} = 0; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
0
|
|
|
0
|
0
|
0
|
sub start_over_text { } |
|
235
|
0
|
|
|
0
|
0
|
0
|
sub start_over_block { } |
|
236
|
0
|
|
|
0
|
0
|
0
|
sub start_over_number { } |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub end_over_bullet |
|
239
|
|
|
|
|
|
|
{ |
|
240
|
1
|
|
|
1
|
0
|
66
|
my $self = shift; |
|
241
|
|
|
|
|
|
|
|
|
242
|
1
|
|
|
|
|
4
|
$self->{'scratch'} .= "\n"; |
|
243
|
|
|
|
|
|
|
|
|
244
|
1
|
|
|
|
|
176
|
$self->end_non_code_text; |
|
245
|
|
|
|
|
|
|
|
|
246
|
1
|
|
|
|
|
53
|
$self->{in_bullet_list} = 0; |
|
247
|
1
|
|
|
|
|
2
|
$self->{bullet_count} = 0; |
|
248
|
1
|
|
|
|
|
6
|
$self->{last_thingy} = 'bullet_list'; |
|
249
|
|
|
|
|
|
|
} |
|
250
|
|
|
|
|
|
|
|
|
251
|
0
|
|
|
0
|
0
|
0
|
sub end_over_text { } |
|
252
|
0
|
|
|
0
|
0
|
0
|
sub end_over_block { } |
|
253
|
0
|
|
|
0
|
0
|
0
|
sub end_over_number { } |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub end_item_bullet |
|
256
|
|
|
|
|
|
|
{ |
|
257
|
3
|
|
|
3
|
0
|
152
|
my $self = shift; |
|
258
|
|
|
|
|
|
|
|
|
259
|
3
|
|
|
|
|
9
|
$self->end_non_code_text; |
|
260
|
|
|
|
|
|
|
|
|
261
|
3
|
|
|
|
|
150
|
$self->{'scratch'} .= ''; |
|
262
|
|
|
|
|
|
|
|
|
263
|
3
|
|
|
|
|
9
|
$self->emit; |
|
264
|
|
|
|
|
|
|
} |
|
265
|
|
|
|
|
|
|
|
|
266
|
0
|
|
|
0
|
0
|
|
sub end_item_number { $_[0]->emit() } |
|
267
|
0
|
|
|
0
|
0
|
|
sub end_item_text { $_[0]->emit() } |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head1 TO DO |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=over 4 |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item * handle item lists |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=back |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
L, L |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
This source is part of a SourceForge project which always has the |
|
284
|
|
|
|
|
|
|
latest sources in CVS, as well as all of the previous releases. |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
http://sourceforge.net/projects/brian-d-foy/ |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
If, for some reason, I disappear from the world, one of the other |
|
289
|
|
|
|
|
|
|
members of the project can shepherd this module appropriately. |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head1 AUTHOR |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
brian d foy, C<< >> |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Copyright (c) 2007, brian d foy, All Rights Reserved. |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
You may redistribute this under the same terms as Perl itself. |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
1; |