-
Notifications
You must be signed in to change notification settings - Fork 10
/
PodViewSpec.pm
43 lines (38 loc) · 995 Bytes
/
PodViewSpec.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package PodViewSpec;
use parent qw( Pod::POM::View::Text );
use Pod::POM::View;
use Text::Wrap;
# overwrite the link default - we don't want
# to reference to "the manpage"
sub view_seq_link {
my ($self, $link) = @_;
$link =~ s,^/,,;
if ($link =~ m/^(.*)\|(.*)/) {
my $ltext = $1;
my $lurl = $2;
if ($ltext eq 'here' || $lurl =~ m/^http/) {
return "at $lurl";
}
return $ltext;
}
return $link;
}
sub view_item {
my ($self, $item) = @_;
my $indent = ref $self ? \$self->{ INDENT } : \$INDENT;
my $pad = ' ' x $$indent;
local $Text::Wrap::unexpand = 0;
my $title = $item->title->present($self);
if ($title !~ m/^\s*$/ && $title ne '*') {
$title = wrap($pad . '* ', $pad . ' ', $title);
$$indent += 2;
my $content = $item->content->present($self);
$$indent -= 2;
return "$title\n\n$content";
} else {
my $content = $item->content->present($self);
chomp $content;
return " * $content\n";
}
}
1;