line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# You may distribute under the terms of either the GNU General Public License |
2
|
|
|
|
|
|
|
# or the Artistic License (the same terms as Perl itself) |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# (C) Paul Evans, 2022 -- leonerd@leonerd.org.uk |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1004
|
use v5.26; |
|
2
|
|
|
|
|
6
|
|
7
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
72
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
13
|
use Object::Pad 0.800; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
91
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package App::sdview::Output::Man 0.13; |
12
|
|
|
|
|
|
|
class App::sdview::Output::Man |
13
|
|
|
|
|
|
|
:does(App::sdview::Output) |
14
|
1
|
|
|
1
|
|
675
|
:strict(params); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
532
|
use constant format => "Man"; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
164
|
|
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
16
|
use List::Util qw( any ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
4195
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
field $_current_mode = ""; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
0
|
5
|
method output_head1 ( $para ) { $self->_output_head( ".SH", $para ); } |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
7
|
|
23
|
1
|
|
|
1
|
0
|
3
|
method output_head2 ( $para ) { $self->_output_head( ".SS", $para ); } |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
5
|
method _output_head ( $directive, $para ) |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
4
|
|
26
|
3
|
|
|
3
|
|
5
|
{ |
27
|
3
|
|
|
|
|
11
|
$self->say( $directive, " ", $self->_convert_str( $para->text ) ); |
28
|
3
|
|
|
|
|
12
|
$_current_mode = "PP"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
7
|
method output_plain ( $para ) |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
6
|
|
32
|
4
|
|
|
4
|
0
|
8
|
{ |
33
|
4
|
100
|
|
|
|
14
|
$self->say( ".PP" ) unless $_current_mode eq "PP"; |
34
|
4
|
|
|
|
|
6
|
$_current_mode = ""; |
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
14
|
$self->say( $self->_convert_str( $para->text ) ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
3
|
method output_verbatim ( $para ) |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
40
|
1
|
|
|
1
|
0
|
2
|
{ |
41
|
1
|
|
|
|
|
4
|
$self->say( ".EX" ); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
4
|
$self->say( $_ ) for split m/\n/, $para->text; |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
4
|
$self->say( ".EE" ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
0
|
4
|
method output_list_bullet ( $para ) { $self->_output_list( $para ); } |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
49
|
1
|
|
|
1
|
0
|
6
|
method output_list_text ( $para ) { $self->_output_list( $para ); } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
50
|
|
|
|
|
|
|
|
51
|
2
|
|
|
|
|
4
|
method _output_list ( $para ) |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
3
|
|
52
|
2
|
|
|
2
|
|
4
|
{ |
53
|
2
|
|
|
|
|
8
|
foreach my $item ( $para->items ) { |
54
|
7
|
100
|
|
|
|
21
|
if( $item->type ne "item" ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
55
|
1
|
|
|
|
|
4
|
$self->say( ".IP" ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
elsif( $para->listtype eq "bullet" ) { |
58
|
3
|
|
|
|
|
10
|
$self->say( ".IP \\(bu" ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
elsif( $para->listtype eq "text" ) { |
61
|
3
|
|
|
|
|
10
|
$self->say( ".TP" ); |
62
|
3
|
|
|
|
|
9
|
$self->say( $self->_convert_str( $item->term ) ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
22
|
$self->say( $self->_convert_str( $item->text ) ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
17
|
|
|
|
|
23
|
method _convert_str ( $s ) |
|
17
|
|
|
|
|
24
|
|
|
17
|
|
|
|
|
25
|
|
70
|
17
|
|
|
17
|
|
33
|
{ |
71
|
17
|
|
|
|
|
23
|
my $ret = ""; |
72
|
|
|
|
|
|
|
|
73
|
17
|
|
|
|
|
23
|
my @fontstack; |
74
|
|
|
|
|
|
|
|
75
|
21
|
|
|
|
|
38
|
$s->iter_substr_nooverlap( |
76
|
21
|
|
|
21
|
|
28
|
sub ( $substr, %tags ) { |
|
21
|
|
|
|
|
1279
|
|
|
21
|
|
|
|
|
27
|
|
77
|
|
|
|
|
|
|
$ret .= "\\fP", pop @fontstack |
78
|
21
|
|
66
|
|
|
63
|
while @fontstack and !$tags{ $fontstack[-1] }; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$tags{monospace} and ( |
81
|
21
|
100
|
66
|
|
|
58
|
any { $_ eq "monospace" } @fontstack or |
|
4
|
|
|
|
|
11
|
|
82
|
|
|
|
|
|
|
$ret .= "\\f(CW", push @fontstack, "monospace" ); |
83
|
|
|
|
|
|
|
$tags{bold} and ( |
84
|
21
|
100
|
33
|
|
|
50
|
any { $_ eq "bold" } @fontstack or |
|
0
|
|
|
|
|
0
|
|
85
|
|
|
|
|
|
|
$ret .= "\\fB", push @fontstack, "bold" ); |
86
|
|
|
|
|
|
|
$tags{italic} and ( |
87
|
21
|
100
|
33
|
|
|
49
|
any { $_ eq "italic" } @fontstack or |
|
0
|
|
|
|
|
0
|
|
88
|
|
|
|
|
|
|
$ret .= "\\fI", push @fontstack, "italic" ); |
89
|
|
|
|
|
|
|
|
90
|
21
|
|
|
|
|
63
|
my $man = $substr =~ s/([\\-])/\\$1/gr; |
91
|
|
|
|
|
|
|
|
92
|
21
|
|
|
|
|
58
|
$ret .= $man; |
93
|
|
|
|
|
|
|
} |
94
|
17
|
|
|
|
|
101
|
); |
95
|
|
|
|
|
|
|
|
96
|
17
|
|
|
|
|
254
|
$ret .= "\\fP", pop @fontstack |
97
|
|
|
|
|
|
|
while @fontstack; |
98
|
|
|
|
|
|
|
|
99
|
17
|
|
|
|
|
58
|
return $ret; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
0x55AA; |