line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2005 Joshua Hoblitt |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# $Id: Pretty.pm,v 1.4 2006/01/07 10:54:24 jhoblitt Exp $ |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Pod::Wrap::Pretty; |
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
72537
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
437
|
|
8
|
|
|
|
|
|
|
|
9
|
10
|
|
|
10
|
|
58
|
use vars qw( $VERSION ); |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
1030
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.03'; |
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
56
|
use base qw( Pod::Wrap ); |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
16342
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
10
|
|
|
10
|
|
84820
|
use Text::Wrap; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
2843
|
|
16
|
|
|
|
|
|
|
|
17
|
10
|
|
|
10
|
|
28
|
$Text::Wrap::columns = 80; |
18
|
10
|
|
|
|
|
24
|
$Text::Wrap::tabstop = 4; # expand tabs to 4 spaces |
19
|
10
|
|
|
|
|
21
|
$Text::Wrap::unexpand = undef; # permanently expand/remove tabs |
20
|
10
|
|
|
|
|
1563
|
$Text::Wrap::huge = 'overflow'; # don't break long words, eg. URLs |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub textblock |
24
|
|
|
|
|
|
|
{ |
25
|
66
|
|
|
66
|
1
|
22986
|
my ($self, $text) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# is it a plain text paragraph? |
28
|
66
|
100
|
|
|
|
328
|
if ($text !~ /^=/mg) { |
29
|
|
|
|
|
|
|
# it is - remove all but the last newline so line the breaks are redone |
30
|
37
|
|
|
|
|
564
|
$text =~ s|$/(?!\Z)| |g; |
31
|
|
|
|
|
|
|
# trim whitespace from the end of the string |
32
|
37
|
|
|
|
|
1842
|
$text =~ s|\s*\z|$/|g; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
66
|
|
|
|
|
320
|
$self->SUPER::textblock($text, @_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |