| 1 | # Convert POD data to formatted *roff input. | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # This module translates POD documentation into *roff markup using the man | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # macro set, and is intended for converting POD documents written as Unix | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # manual pages to manual pages that can be read by the man(1) command. It is | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # a replacement for the pod2man command distributed with versions of Perl | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # prior to 5.6. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # Modules and declarations | ||||||||||||||||||||||||||||||||||||||||||
| 13 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | package Pod::Man v6.1.1; | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | use 5.012; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 12 | ▶ | use parent qw(Pod::Simple); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 12 | ▶ | use Carp qw(carp croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | # Conditionally import Encode and set $HAS_ENCODE if it is available. This is | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # required to support building as part of Perl core, since podlators is built | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # before Encode is. | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 12 | my $HAS_ENCODE; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 12 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 12 | $HAS_ENCODE = eval { require Encode }; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # Ensure that $Pod::Simple::nbsp and $Pod::Simple::shy are available. Code | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # taken from Pod::Simple 3.32, but was only added in 3.30. | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 12 | my ($NBSP, $SHY); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 12 | ▶ | if ($Pod::Simple::VERSION ge 3.30) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 12 | $NBSP = $Pod::Simple::nbsp; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 12 | $SHY = $Pod::Simple::shy; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $NBSP = chr(utf8::unicode_to_native(0xA0)); | |||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $SHY = chr(utf8::unicode_to_native(0xAD)); | |||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # Import the ASCII constant from Pod::Simple. This is true iff we're in an | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # ASCII-based universe (including such things as ISO 8859-1 and UTF-8), and is | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # generally only false for EBCDIC. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 12 | ▶ | BEGIN { *ASCII = \&Pod::Simple::ASCII } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | # Formatting instructions for various types of blocks. cleanup makes hyphens | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # hard, adds spaces between consecutive underscores, and escapes backslashes. | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # convert translates characters into escapes. guesswork means to apply the | ||||||||||||||||||||||||||||||||||||||||||
| 51 | # transformations done by the guesswork sub (if enabled). | ||||||||||||||||||||||||||||||||||||||||||
| 52 | # | ||||||||||||||||||||||||||||||||||||||||||
| 53 | # DEFAULT specifies the default settings. All other elements should list only | ||||||||||||||||||||||||||||||||||||||||||
| 54 | # those settings that they are overriding. Data indicates =for roff blocks, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # which should be passed along completely verbatim. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | # | ||||||||||||||||||||||||||||||||||||||||||
| 57 | # Formatting inherits negatively, in the sense that if the parent has turned | ||||||||||||||||||||||||||||||||||||||||||
| 58 | # off guesswork, all child elements should leave it off. | ||||||||||||||||||||||||||||||||||||||||||
| 59 | #<<< | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 12 | my %FORMATTING = ( | |||||||||||||||||||||||||||||||||||||||||
| 61 | DEFAULT => { cleanup => 1, convert => 1, guesswork => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | Data => { cleanup => 0, convert => 0, guesswork => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | Verbatim => { guesswork => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | C => { guesswork => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | X => { cleanup => 0, guesswork => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 67 | #>>> | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | # Try to map an encoding as understood by Perl Encode to an encoding | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # understood by groff's preconv. Encode doesn't care about hyphens or | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # capitalization, but preconv does. The key is the canonicalized Encode | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # encoding, and the value is something preconv might understand. | ||||||||||||||||||||||||||||||||||||||||||
| 73 | # | ||||||||||||||||||||||||||||||||||||||||||
| 74 | # FreeBSD mandoc only understands utf-8 and iso-latin-1 as of 2022-09-24. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | # groff preconv prefers iso-8859-1, but also understands iso-latin-1, so | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # convert ISO-8859-1 to iso-latin-1 for FreeBSD. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 12 | my %ENCODINGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 78 | ascii => 'us-ascii', | ||||||||||||||||||||||||||||||||||||||||||
| 79 | big5 => 'big5', | ||||||||||||||||||||||||||||||||||||||||||
| 80 | big5eten => 'big5', | ||||||||||||||||||||||||||||||||||||||||||
| 81 | cp950 => 'big5', | ||||||||||||||||||||||||||||||||||||||||||
| 82 | cp1047 => 'cp1047', | ||||||||||||||||||||||||||||||||||||||||||
| 83 | euccn => 'gb2312', | ||||||||||||||||||||||||||||||||||||||||||
| 84 | eucjp => 'euc-jp', | ||||||||||||||||||||||||||||||||||||||||||
| 85 | euckr => 'euc-kr', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | gb2312 => 'gb2312', | ||||||||||||||||||||||||||||||||||||||||||
| 87 | gb2312raw => 'gb2312', | ||||||||||||||||||||||||||||||||||||||||||
| 88 | iso88591 => 'iso-latin-1', | ||||||||||||||||||||||||||||||||||||||||||
| 89 | iso88592 => 'iso-8859-2', | ||||||||||||||||||||||||||||||||||||||||||
| 90 | iso88595 => 'iso-8859-5', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | iso88597 => 'iso-8859-7', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | iso88599 => 'iso-8859-9', | ||||||||||||||||||||||||||||||||||||||||||
| 93 | iso885913 => 'iso-8859-13', | ||||||||||||||||||||||||||||||||||||||||||
| 94 | iso885915 => 'iso-8859-15', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | koi8r => 'koi8-r', | ||||||||||||||||||||||||||||||||||||||||||
| 96 | latin1 => 'iso-8859-1', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | usascii => 'us-ascii', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | utf8 => 'utf-8', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | utf16 => 'utf-16', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | utf16be => 'utf-16be', | ||||||||||||||||||||||||||||||||||||||||||
| 101 | utf16le => 'utf-16le', | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 105 | # Translation tables | ||||||||||||||||||||||||||||||||||||||||||
| 106 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # The following table is adapted from Tom Christiansen's pod2man. It is only | ||||||||||||||||||||||||||||||||||||||||||
| 109 | # used with roff output. It assumes that the standard preamble has already | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # been printed, since that's what defines all of the accent marks. We really | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # want to do something better than this when *roff actually supports other | ||||||||||||||||||||||||||||||||||||||||||
| 112 | # character sets itself, since these results are pretty poor. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | # | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # This only works in an ASCII world. What to do in a non-ASCII world is very | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # unclear, so we just output what we get and hope for the best. | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 12 | my %ESCAPES; | |||||||||||||||||||||||||||||||||||||||||
| 117 | #<<< | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 12 | @ESCAPES{0xA0 .. 0xFF} = ( | |||||||||||||||||||||||||||||||||||||||||
| 119 | $NBSP, undef, undef, undef, undef, undef, undef, undef, | ||||||||||||||||||||||||||||||||||||||||||
| 120 | undef, undef, undef, undef, undef, $SHY, undef, undef, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | undef, undef, undef, undef, undef, undef, undef, undef, | ||||||||||||||||||||||||||||||||||||||||||
| 123 | undef, undef, undef, undef, undef, undef, undef, undef, | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | "A\\*`", "A\\*'", "A\\*^", "A\\*~", "A\\*:", "A\\*o", "\\*(Ae", "C\\*,", | ||||||||||||||||||||||||||||||||||||||||||
| 126 | "E\\*`", "E\\*'", "E\\*^", "E\\*:", "I\\*`", "I\\*'", "I\\*^", "I\\*:", | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | "\\*(D-", "N\\*~", "O\\*`", "O\\*'", "O\\*^", "O\\*~", "O\\*:", undef, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | "O\\*/", "U\\*`", "U\\*'", "U\\*^", "U\\*:", "Y\\*'", "\\*(Th", "\\*8", | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | "a\\*`", "a\\*'", "a\\*^", "a\\*~", "a\\*:", "a\\*o", "\\*(ae", "c\\*,", | ||||||||||||||||||||||||||||||||||||||||||
| 132 | "e\\*`", "e\\*'", "e\\*^", "e\\*:", "i\\*`", "i\\*'", "i\\*^", "i\\*:", | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | "\\*(d-", "n\\*~", "o\\*`", "o\\*'", "o\\*^", "o\\*~", "o\\*:", undef, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | "o\\*/" , "u\\*`", "u\\*'", "u\\*^", "u\\*:", "y\\*'", "\\*(th", "y\\*:", | ||||||||||||||||||||||||||||||||||||||||||
| 136 | ) if ASCII; | ||||||||||||||||||||||||||||||||||||||||||
| 137 | #>>> | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # Utility functions | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | # Quote an argument to a macro. | ||||||||||||||||||||||||||||||||||||||||||
| 144 | # | ||||||||||||||||||||||||||||||||||||||||||
| 145 | # $arg - Intended argument to the macro | ||||||||||||||||||||||||||||||||||||||||||
| 146 | # | ||||||||||||||||||||||||||||||||||||||||||
| 147 | # Returns: $arg suitably escaped and quoted | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 611 | ▶ | sub _quote_macro_argument { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_quote_macro_argument: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 611 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 611 | ▶ | if (length($arg) > 0 && $arg !~ m{ [\s\"] }xms) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
length $arg > 0 and not $arg =~ / [\s\"] /msux
MC/DC100%2/2
length $arg > 0 and not $arg =~ / [\s\"] /msux
length $arg > 0
not $arg =~ / [\s\"] /msux
Truth table100%3/3
A and not(B)
A= length $arg > 0B= not $arg =~ / [\s\"] /msux
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 322 | return $arg; | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 289 | $arg =~ s{ \" }{""}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 289 | return qq("$arg"); | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | # Returns whether the given encoding needs a call to Encode::encode. | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 1775 | ▶ | sub _needs_encode { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_needs_encode: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 1775 | my ($encoding) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 1775 | ▶ | return $encoding ne 'roff' && $encoding ne 'groff'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$encoding ne 'roff' && $encoding ne 'groff'
MC/DC100%2/2
$encoding ne 'roff' && $encoding ne 'groff'
$encoding ne 'roff'
$encoding ne 'groff'
Truth table100%3/3
A && B
A= $encoding ne 'roff'B= $encoding ne 'groff'
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 164 | # Object initialization | ||||||||||||||||||||||||||||||||||||||||||
| 165 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | # Initialize the object and set various Pod::Simple options that we need. | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # Here, we also process any additional options passed to the constructor or | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # set up defaults if none were given. Note that all internal object keys are | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # in all-caps, reserving all lower-case object keys for Pod::Simple and user | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 82 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=18 SCAR=29.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 82 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 82 | my $self = $class->SUPER::new; | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | # Tell Pod::Simple to keep whitespace whenever possible. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 82 | ▶ | if (my $preserve_whitespace = $self->can ('preserve_whitespace')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 82 | $self->$preserve_whitespace (1); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->fullstop_space_harden (1); | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | # The =for and =begin targets that we accept. | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 82 | $self->accept_targets (qw/man MAN roff ROFF/); | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | # Ensure that contiguous blocks of code are merged together. Otherwise, | ||||||||||||||||||||||||||||||||||||||||||
| 187 | # some of the guesswork heuristics don't work right. | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 82 | $self->merge_text (1); | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | # Pod::Simple doesn't do anything useful with our arguments, but we want | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # to put them in our object as hash keys and values. This could cause | ||||||||||||||||||||||||||||||||||||||||||
| 192 | # problems if we ever clash with Pod::Simple's own internal class | ||||||||||||||||||||||||||||||||||||||||||
| 193 | # variables. | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 82 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 82 | my @opts = map { ("opt_$_", $opts{$_}) } keys %opts; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 82 | %$self = (%$self, @opts); | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | # Pod::Simple uses encoding internally, so we need to store it as | ||||||||||||||||||||||||||||||||||||||||||
| 199 | # ENCODING. Set the default to UTF-8 if not specified. | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # Degrade to the old roff encoding if Encode is not available. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | # | ||||||||||||||||||||||||||||||||||||||||||
| 203 | # Suppress the warning message when PERL_CORE is set, indicating this is | ||||||||||||||||||||||||||||||||||||||||||
| 204 | # running as part of the core Perl build. Perl builds podlators (and all | ||||||||||||||||||||||||||||||||||||||||||
| 205 | # pure Perl modules) before Encode and other XS modules, so Encode won't | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # yet be available. Rely on the Perl core build to generate man pages | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # later, after all the modules are available, so that UTF-8 handling will | ||||||||||||||||||||||||||||||||||||||||||
| 208 | # be correct. | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 82 | my %options = @_; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 82 | ▶ | if (defined $self->{opt_encoding}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 17 | $$self{ENCODING} = $self->{opt_encoding}; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } elsif (ASCII) { | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 65 | $$self{ENCODING} = 'UTF-8'; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | $$self{ENCODING} = 'groff'; | ||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 82 | ▶ | if (_needs_encode($$self{ENCODING}) && !$HAS_ENCODE) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
_needs_encode($self->{"ENCODING"}) and not $HAS_ENCODE
MC/DC100%2/2
_needs_encode($self->{"ENCODING"}) and not $HAS_ENCODE
_needs_encode($self->{"ENCODING"})
not $HAS_ENCODE
Truth table100%3/3
A and not(B)
A= _needs_encode($self->{"ENCODING"})B= not $HAS_ENCODE
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | ▶ | if (!$ENV{PERL_CORE}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | carp ('encoding requested but Encode module not available,' | |||||||||||||||||||||||||||||||||||||||||
| 220 | . ' falling back to groff escapes'); | ||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 2 | $$self{ENCODING} = 'groff'; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | # Send errors to stderr if requested. | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 82 | ▶ | if ($self->{opt_stderr} and not $self->{opt_errors}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"opt_stderr"} and not $self->{"opt_errors"}
MC/DC50%1/2
$self->{"opt_stderr"} and not $self->{"opt_errors"}
$self->{"opt_stderr"}
not $self->{"opt_errors"}
Truth table66%2/3
A and not(B)
A= $self->{"opt_stderr"}B= not $self->{"opt_errors"}
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | $self->{opt_errors} = 'stderr'; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 82 | delete $self->{opt_stderr}; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | # Validate the errors parameter and act on it. | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 82 | ▶ | $self->{opt_errors} //= 'pod'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_errors"} //= "pod"
MC/DC100%1/1
$self->{"opt_errors"} //= "pod"
$self->{"opt_errors"}
Truth table100%2/2
A
A= $self->{"opt_errors"}
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 82 | ▶ | if ($self->{opt_errors} eq 'stderr' || $self->{opt_errors} eq 'die') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$self->{"opt_errors"} eq "stderr" or $self->{"opt_errors"} eq "die"
MC/DC100%2/2
$self->{"opt_errors"} eq "stderr" or $self->{"opt_errors"} eq "die"
$self->{"opt_errors"} eq "stderr"
$self->{"opt_errors"} eq "die"
Truth table100%3/3
A or B
A= $self->{"opt_errors"} eq "stderr"B= $self->{"opt_errors"} eq "die"
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 4 | $self->no_errata_section (1); | |||||||||||||||||||||||||||||||||||||||||
| 235 | 4 | $self->complain_stderr (1); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 4 | ▶ | if ($self->{opt_errors} eq 'die') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | $self->{complain_die} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | } elsif ($self->{opt_errors} eq 'pod') { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 76 | $self->no_errata_section (0); | |||||||||||||||||||||||||||||||||||||||||
| 241 | 76 | $self->complain_stderr (0); | |||||||||||||||||||||||||||||||||||||||||
| 242 | } elsif ($self->{opt_errors} eq 'none') { | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 2 | $self->no_errata_section (1); | |||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | $self->no_whining (1); | |||||||||||||||||||||||||||||||||||||||||
| 245 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | croak (qq(Invalid errors setting: "$self->{opt_errors}")); | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 82 | delete $self->{opt_errors}; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | # Initialize various other internal constants based on our arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 82 | $self->init_fonts; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 82 | $self->init_quotes; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 82 | $self->init_page; | |||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | # Configure guesswork based on options. | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 82 | ▶ | my $guesswork = $self->{opt_guesswork} || q{}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'opt_guesswork'} || ''
MC/DC100%1/1
$self->{'opt_guesswork'} || ''
$self->{'opt_guesswork'}
Truth table100%2/2
A
A= $self->{'opt_guesswork'}
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 82 | my %guesswork = map { $_ => 1 } split(m{,}xms, $guesswork); | |||||||||||||||||||||||||||||||||||||||||
| 258 | 82 | ▶ | if (!%guesswork || $guesswork{all}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
not %guesswork or $guesswork{"all"}
MC/DC100%2/2
not %guesswork or $guesswork{"all"}
not %guesswork
$guesswork{"all"}
Truth table100%3/3
not(A) or B
A= not %guessworkB= $guesswork{"all"}
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | $$self{GUESSWORK} = { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 79 | functions => 1, | |||||||||||||||||||||||||||||||||||||||||
| 261 | manref => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 262 | quoting => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 263 | variables => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 264 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 265 | } elsif ($guesswork{none}) { | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 2 | $$self{GUESSWORK} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 1 | $$self{GUESSWORK} = {%guesswork}; | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 82 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | # Translate a font string into an escape. | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 328 | ▶ | sub toescape { (length ($_[0]) > 1 ? '\f(' : '\f') . $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toescape: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | # Determine which fonts the user wishes to use and store them in the object. | ||||||||||||||||||||||||||||||||||||||||||
| 278 | # Regular, italic, bold, and bold-italic are constants, but the fixed width | ||||||||||||||||||||||||||||||||||||||||||
| 279 | # fonts may be set by the user. Sets the internal hash key FONTS which is | ||||||||||||||||||||||||||||||||||||||||||
| 280 | # used to map our internal font escapes to actual *roff sequences later. | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 82 | ▶ | sub init_fonts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_fonts: called CC=9 SCAR=22.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 82 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | # Figure out the fixed-width font. If user-supplied, make sure that they | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # are the right length. | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 82 | for (qw(fixed fixedbold fixeditalic fixedbolditalic)) { | |||||||||||||||||||||||||||||||||||||||||
| 287 | 328 | my $font = $self->{"opt_$_"}; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 328 | ▶ | if (defined($font) && (length($font) < 1 || length($font) > 2)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $font and length $font < 1 || length $font > 2
length $font < 1 or length $font > 2
MC/DC0%0/3
defined $font and length $font < 1 || length $font > 2
defined $font
length $font < 1
length $font > 2
Truth table50%2/4
A and B or C
A= defined $fontB= length $font < 1C= length $font > 2
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | croak(qq(roff font should be 1 or 2 chars, not "$font")); | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | # Set the default fonts. We can't be sure portably across different | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # implementations what fixed bold-italic may be called (if it's even | ||||||||||||||||||||||||||||||||||||||||||
| 295 | # available), so default to just bold. | ||||||||||||||||||||||||||||||||||||||||||
| 296 | #<<< | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 82 | ▶ | $self->{opt_fixed} ||= 'CR'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_fixed"} ||= "CR"
MC/DC100%1/1
$self->{"opt_fixed"} ||= "CR"
$self->{"opt_fixed"}
Truth table100%2/2
A
A= $self->{"opt_fixed"}
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 82 | ▶ | $self->{opt_fixedbold} ||= 'CB'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_fixedbold"} ||= "CB"
MC/DC100%1/1
$self->{"opt_fixedbold"} ||= "CB"
$self->{"opt_fixedbold"}
Truth table100%2/2
A
A= $self->{"opt_fixedbold"}
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 82 | ▶ | $self->{opt_fixeditalic} ||= 'CI'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_fixeditalic"} ||= "CI"
MC/DC100%1/1
$self->{"opt_fixeditalic"} ||= "CI"
$self->{"opt_fixeditalic"}
Truth table100%2/2
A
A= $self->{"opt_fixeditalic"}
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | 82 | ▶ | $self->{opt_fixedbolditalic} ||= 'CB'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_fixedbolditalic"} ||= "CB"
MC/DC100%1/1
$self->{"opt_fixedbolditalic"} ||= "CB"
$self->{"opt_fixedbolditalic"}
Truth table100%2/2
A
A= $self->{"opt_fixedbolditalic"}
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | #>>> | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # Set up a table of font escapes. First number is fixed-width, second is | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # bold, third is italic. | ||||||||||||||||||||||||||||||||||||||||||
| 305 | $self->{FONTS} = { | ||||||||||||||||||||||||||||||||||||||||||
| 306 | '000' => '\fR', | ||||||||||||||||||||||||||||||||||||||||||
| 307 | '001' => '\fI', | ||||||||||||||||||||||||||||||||||||||||||
| 308 | '010' => '\fB', | ||||||||||||||||||||||||||||||||||||||||||
| 309 | '011' => '\f(BI', | ||||||||||||||||||||||||||||||||||||||||||
| 310 | '100' => toescape($self->{opt_fixed}), | ||||||||||||||||||||||||||||||||||||||||||
| 311 | '101' => toescape($self->{opt_fixeditalic}), | ||||||||||||||||||||||||||||||||||||||||||
| 312 | '110' => toescape($self->{opt_fixedbold}), | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 82 | '111' => toescape($self->{opt_fixedbolditalic}), | |||||||||||||||||||||||||||||||||||||||||
| 314 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | # Precalculate a regex that matches all fixed-width fonts, which will be | ||||||||||||||||||||||||||||||||||||||||||
| 317 | # used later by switchquotes. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 82 | my @fixedpat = map { quotemeta($self->{FONTS}{$_}) } qw(100 101 110 111); | |||||||||||||||||||||||||||||||||||||||||
| 319 | 82 | my $fixedpat = join('|', @fixedpat); | |||||||||||||||||||||||||||||||||||||||||
| 320 | 82 | $self->{FIXEDPAT} = qr{ $fixedpat }xms; | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | # Initialize the quotes that we'll be using for C<> text. This requires some | ||||||||||||||||||||||||||||||||||||||||||
| 324 | # special handling, both to parse the user parameters if given and to make | ||||||||||||||||||||||||||||||||||||||||||
| 325 | # sure that the quotes will be safe against *roff. Sets the internal hash | ||||||||||||||||||||||||||||||||||||||||||
| 326 | # keys LQUOTE and RQUOTE. | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 82 | ▶ | sub init_quotes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_quotes: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 82 | my ($self) = (@_); | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | # Handle the quotes option first, which sets both quotes at once. | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 82 | ▶ | $self->{opt_quotes} ||= '"'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_quotes"} ||= "\""
MC/DC100%1/1
$self->{"opt_quotes"} ||= "\""
$self->{"opt_quotes"}
Truth table100%2/2
A
A= $self->{"opt_quotes"}
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 82 | ▶ | if ($self->{opt_quotes} eq 'none') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | $$self{LQUOTE} = $$self{RQUOTE} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } elsif (length ($self->{opt_quotes}) == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 80 | $$self{LQUOTE} = $$self{RQUOTE} = $self->{opt_quotes}; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } elsif (length ($self->{opt_quotes}) % 2 == 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | my $length = length ($self->{opt_quotes}) / 2; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | $$self{LQUOTE} = substr ($self->{opt_quotes}, 0, $length); | |||||||||||||||||||||||||||||||||||||||||
| 339 | 1 | $$self{RQUOTE} = substr ($self->{opt_quotes}, $length); | |||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | croak(qq(Invalid quote specification "$self->{opt_quotes}")) | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | # Now handle the lquote and rquote options. | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 82 | ▶ | if (defined($self->{opt_lquote})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 3 | ▶ | $self->{opt_lquote} = q{} if $self->{opt_lquote} eq 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 3 | $$self{LQUOTE} = $self->{opt_lquote}; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 82 | ▶ | if (defined $self->{opt_rquote}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 3 | ▶ | $self->{opt_rquote} = q{} if $self->{opt_rquote} eq 'none'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 3 | $$self{RQUOTE} = $self->{opt_rquote}; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | # Initialize the page title information and indentation from our arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 82 | ▶ | sub init_page { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_page: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 82 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | # Get the version from the running Perl. | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 82 | my @version = ($] =~ /^(\d+)\.(\d{3})(\d+)$/); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 82 | for (@version) { $_ += 0 } | |||||||||||||||||||||||||||||||||||||||||
| 362 | 82 | my $version = join ('.', @version); | |||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | # Set the defaults for page titles and indentation if the user didn't | ||||||||||||||||||||||||||||||||||||||||||
| 365 | # override anything. | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 82 | ▶ | $self->{opt_center} //= 'User Contributed Perl Documentation'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_center"} //= "User Contributed Perl Documentation"
MC/DC100%1/1
$self->{"opt_center"} //= "User Contributed Perl Documentation"
$self->{"opt_center"}
Truth table100%2/2
A
A= $self->{"opt_center"}
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 82 | ▶ | $self->{opt_release} //= 'perl v' . $version; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"opt_release"} //= 'perl v' . $version
MC/DC100%1/1
$self->{"opt_release"} //= 'perl v' . $version
$self->{"opt_release"}
Truth table100%2/2
A
A= $self->{"opt_release"}
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 82 | ▶ | $self->{opt_indent} //= 4; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"opt_indent"} //= 4
MC/DC0%0/1
$self->{"opt_indent"} //= 4
$self->{"opt_indent"}
Truth table50%1/2
A
A= $self->{"opt_indent"}
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 372 | # Core parsing | ||||||||||||||||||||||||||||||||||||||||||
| 373 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | # This is the glue that connects the code below with Pod::Simple itself. The | ||||||||||||||||||||||||||||||||||||||||||
| 376 | # goal is to convert the event stream coming from the POD parser into method | ||||||||||||||||||||||||||||||||||||||||||
| 377 | # calls to handlers once the complete content of a tag has been seen. Each | ||||||||||||||||||||||||||||||||||||||||||
| 378 | # paragraph or POD command will have textual content associated with it, and | ||||||||||||||||||||||||||||||||||||||||||
| 379 | # as soon as all of a paragraph or POD command has been seen, that content | ||||||||||||||||||||||||||||||||||||||||||
| 380 | # will be passed in to the corresponding method for handling that type of | ||||||||||||||||||||||||||||||||||||||||||
| 381 | # object. The exceptions are handlers for lists, which have opening tag | ||||||||||||||||||||||||||||||||||||||||||
| 382 | # handlers and closing tag handlers that will be called right away. | ||||||||||||||||||||||||||||||||||||||||||
| 383 | # | ||||||||||||||||||||||||||||||||||||||||||
| 384 | # The internal hash key PENDING is used to store the contents of a tag until | ||||||||||||||||||||||||||||||||||||||||||
| 385 | # all of it has been seen. It holds a stack of open tags, each one | ||||||||||||||||||||||||||||||||||||||||||
| 386 | # represented by a tuple of the attributes hash for the tag, formatting | ||||||||||||||||||||||||||||||||||||||||||
| 387 | # options for the tag (which are inherited), and the contents of the tag. | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | # Add a block of text to the contents of the current node, formatting it | ||||||||||||||||||||||||||||||||||||||||||
| 390 | # according to the current formatting instructions as we do. | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 919 | ▶ | sub _handle_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_text: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 919 | my ($self, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 919 | my $tag = $$self{PENDING}[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 394 | 919 | $$tag[2] .= $self->format_text ($$tag[1], $text); | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | # Given an element name, get the corresponding method name. | ||||||||||||||||||||||||||||||||||||||||||
| 398 | 1868 | ▶ | sub method_for_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_for_element: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 1868 | my ($self, $element) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 1868 | $element =~ tr/A-Z-/a-z_/; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 1868 | $element =~ tr/_a-z0-9//cd; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 1868 | return $element; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | # Handle the start of a new element. If cmd_element is defined, assume that | ||||||||||||||||||||||||||||||||||||||||||
| 406 | # we need to collect the entire tree for this element before passing it to the | ||||||||||||||||||||||||||||||||||||||||||
| 407 | # element method, and create a new tree into which we'll collect blocks of | ||||||||||||||||||||||||||||||||||||||||||
| 408 | # text and nested elements. Otherwise, if start_element is defined, call it. | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 934 | ▶ | sub _handle_element_start { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_element_start: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 934 | my ($self, $element, $attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 934 | my $method = $self->method_for_element ($element); | |||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | # If we have a command handler, we need to accumulate the contents of the | ||||||||||||||||||||||||||||||||||||||||||
| 414 | # tag before calling it. Turn off IN_NAME for any command other than | ||||||||||||||||||||||||||||||||||||||||||
| 415 | # <Para> and the formatting codes so that IN_NAME isn't still set for the | ||||||||||||||||||||||||||||||||||||||||||
| 416 | # first heading after the NAME heading. | ||||||||||||||||||||||||||||||||||||||||||
| 417 | 934 | ▶ | if ($self->can ("cmd_$method")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 804 | ▶ | $$self{IN_NAME} = 0 if ($element ne 'Para' && length ($element) > 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$element ne "Para" and length $element > 1
MC/DC100%2/2
$element ne "Para" and length $element > 1
$element ne "Para"
length $element > 1
Truth table100%3/3
A and B
A= $element ne "Para"B= length $element > 1
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | # How we're going to format embedded text blocks depends on the tag | ||||||||||||||||||||||||||||||||||||||||||
| 421 | # and also depends on our parent tags. Thankfully, inside tags that | ||||||||||||||||||||||||||||||||||||||||||
| 422 | # turn off guesswork and reformatting, nothing else can turn it back | ||||||||||||||||||||||||||||||||||||||||||
| 423 | # on, so this can be strictly inherited. | ||||||||||||||||||||||||||||||||||||||||||
| 424 | my $formatting = { | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 804 | ▶ | %{ $$self{PENDING}[-1][1] || $FORMATTING{DEFAULT} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'PENDING'}[-1][1] || $FORMATTING{'DEFAULT'}
MC/DC0%0/2
$self->{'PENDING'}[-1][1] || $FORMATTING{'DEFAULT'}
$self->{'PENDING'}[-1][1]
$FORMATTING{'DEFAULT'}
Truth table66%2/3
A || B
A= $self->{'PENDING'}[-1][1]B= $FORMATTING{'DEFAULT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 804 | ▶ | %{ $FORMATTING{$element} || {} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$FORMATTING{$element} || {}
MC/DC100%1/1
$FORMATTING{$element} || {}
$FORMATTING{$element}
Truth table100%2/2
A
A= $FORMATTING{$element}
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 804 | push (@{ $$self{PENDING} }, [ $attrs, $formatting, '' ]); | |||||||||||||||||||||||||||||||||||||||||
| 429 | } elsif (my $start_method = $self->can ("start_$method")) { | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 126 | $self->$start_method ($attrs, ''); | |||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | # Handle the end of an element. If we had a cmd_ method for this element, | ||||||||||||||||||||||||||||||||||||||||||
| 435 | # this is where we pass along the tree that we built. Otherwise, if we have | ||||||||||||||||||||||||||||||||||||||||||
| 436 | # an end_ method for the element, call that. | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 934 | ▶ | sub _handle_element_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_element_end: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 934 | my ($self, $element) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 439 | 934 | my $method = $self->method_for_element ($element); | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | # If we have a command handler, pull off the pending text and pass it to | ||||||||||||||||||||||||||||||||||||||||||
| 442 | # the handler along with the saved attribute hash. | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 934 | ▶ | if (my $cmd_method = $self->can ("cmd_$method")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 804 | my $tag = pop @{ $$self{PENDING} }; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 804 | my $text = $self->$cmd_method ($$tag[0], $$tag[2]); | |||||||||||||||||||||||||||||||||||||||||
| 446 | 804 | ▶ | if (defined $text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 770 | ▶ | if (@{ $$self{PENDING} } > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 280 | $$self{PENDING}[-1][2] .= $text; | |||||||||||||||||||||||||||||||||||||||||
| 449 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 450 | 490 | $self->output ($text); | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | } elsif (my $end_method = $self->can ("end_$method")) { | ||||||||||||||||||||||||||||||||||||||||||
| 454 | 126 | $self->$end_method (); | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 459 | # General formatting | ||||||||||||||||||||||||||||||||||||||||||
| 460 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | # Format a text block. Takes a hash of formatting options and the text to | ||||||||||||||||||||||||||||||||||||||||||
| 463 | # format. Currently, the only formatting options are guesswork, cleanup, and | ||||||||||||||||||||||||||||||||||||||||||
| 464 | # convert, all of which are boolean. | ||||||||||||||||||||||||||||||||||||||||||
| 465 | 934 | ▶ | sub format_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_text: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | 934 | my ($self, $options, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 934 | ▶ | my $guesswork = $$options{guesswork} && !$$self{IN_NAME}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$options->{'guesswork'} && !$self->{'IN_NAME'}
MC/DC100%2/2
$options->{'guesswork'} && !$self->{'IN_NAME'}
$options->{'guesswork'}
!$self->{'IN_NAME'}
Truth table100%3/3
A && not(B)
A= $options->{'guesswork'}B= !$self->{'IN_NAME'}
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 934 | my $cleanup = $$options{cleanup}; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 934 | my $convert = $$options{convert}; | |||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | # Cleanup just tidies up a few things, telling *roff that the hyphens are | ||||||||||||||||||||||||||||||||||||||||||
| 472 | # hard, putting a bit of space between consecutive underscores, escaping | ||||||||||||||||||||||||||||||||||||||||||
| 473 | # backslashes, and converting zero-width spaces to zero-width break | ||||||||||||||||||||||||||||||||||||||||||
| 474 | # points. | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 934 | ▶ | if ($cleanup) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 925 | $text =~ s/\\/\\e/g; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 925 | $text =~ s/-/\\-/g; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 925 | $text =~ s/_(?=_)/_\\|/g; | |||||||||||||||||||||||||||||||||||||||||
| 479 | 925 | $text =~ s/\x{200B}/\\:/g; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | # Except in <Data> blocks, if groff or roff encoding is requested and | ||||||||||||||||||||||||||||||||||||||||||
| 483 | # we're in an ASCII environment, do the encoding. For EBCDIC, we just | ||||||||||||||||||||||||||||||||||||||||||
| 484 | # write what we get and hope for the best. Leave non-breaking spaces and | ||||||||||||||||||||||||||||||||||||||||||
| 485 | # soft hyphens alone; we'll convert those at the last minute. | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 934 | ▶ | if ($convert) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | 930 | if (ASCII) { | |||||||||||||||||||||||||||||||||||||||||
| 488 | 930 | ▶ | if ($$self{ENCODING} eq 'groff') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | 21 | $text =~ s{ ([^\x00-\x7F\xA0\xAD]) }{ | |||||||||||||||||||||||||||||||||||||||||
| 490 | 9 | '\\[u' . sprintf('%04X', ord($1)) . ']' | |||||||||||||||||||||||||||||||||||||||||
| 491 | }xmsge; | ||||||||||||||||||||||||||||||||||||||||||
| 492 | } elsif ($$self{ENCODING} eq 'roff') { | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 24 | ▶ | $text =~ s/([^\x00-\x7F\xA0\xAD])/$ESCAPES{ord ($1)} || "X"/eg; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ESCAPES{ord $1} || 'X'
MC/DC100%1/1
$ESCAPES{ord $1} || 'X'
$ESCAPES{ord $1}
Truth table100%2/2
A
A= $ESCAPES{ord $1}
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | # Ensure that *roff doesn't convert literal quotes to UTF-8 single quotes, | ||||||||||||||||||||||||||||||||||||||||||
| 499 | # but don't mess up accent escapes. | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 934 | $text =~ s/(?<!\\\*)\'/\\*\(Aq/g; | |||||||||||||||||||||||||||||||||||||||||
| 501 | 934 | $text =~ s/(?<!\\\*)\`/\\\`/g; | |||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | # If guesswork is is viable for this block, do that. | ||||||||||||||||||||||||||||||||||||||||||
| 504 | 934 | ▶ | if ($guesswork) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 744 | $text = $self->guesswork ($text); | |||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 934 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | # Handles C<> text, deciding whether to put \*C` around it or not. This is a | ||||||||||||||||||||||||||||||||||||||||||
| 512 | # whole bunch of messy heuristics to try to avoid overquoting, originally from | ||||||||||||||||||||||||||||||||||||||||||
| 513 | # Barrie Slaymaker. This largely duplicates similar code in Pod::Text. | ||||||||||||||||||||||||||||||||||||||||||
| 514 | 118 | ▶ | sub quote_literal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_literal: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | 118 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 118 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | # If in NAME section, just return an ASCII quoted string to avoid | ||||||||||||||||||||||||||||||||||||||||||
| 519 | # confusing tools like whatis. | ||||||||||||||||||||||||||||||||||||||||||
| 520 | 118 | ▶ | if ($$self{IN_NAME}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | 3 | return $self->{LQUOTE} . $_ . $self->{RQUOTE}; | |||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | # A regex that matches the portion of a variable reference that's the | ||||||||||||||||||||||||||||||||||||||||||
| 525 | # array or hash index, separated out just because we want to use it in | ||||||||||||||||||||||||||||||||||||||||||
| 526 | # several places in the following regex. | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 115 | my $index = '(?: \[[^]]+\] | \{[^}]+\} )?'; | |||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | # Check for things that we don't want to quote, and if we find any of | ||||||||||||||||||||||||||||||||||||||||||
| 530 | # them, return the string with just a font change and no quoting. | ||||||||||||||||||||||||||||||||||||||||||
| 531 | # | ||||||||||||||||||||||||||||||||||||||||||
| 532 | # Traditionally, Pod::Man has not quoted Perl variables, functions, | ||||||||||||||||||||||||||||||||||||||||||
| 533 | # numbers, or hex constants, but this is not always desirable. Make this | ||||||||||||||||||||||||||||||||||||||||||
| 534 | # optional on the quoting guesswork flag. | ||||||||||||||||||||||||||||||||||||||||||
| 535 | 115 | my $extra = qr{(?!)}xms; # never matches | |||||||||||||||||||||||||||||||||||||||||
| 536 | 115 | ▶ | if ($$self{GUESSWORK}{quoting}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | 94 | $extra = qr{ | |||||||||||||||||||||||||||||||||||||||||
| 538 | \$+ [\#^]? \S $index # special ($^F, $") | ||||||||||||||||||||||||||||||||||||||||||
| 539 | | [\$\@%&*]+ \#? [:\'\w]+ $index # plain var or func | ||||||||||||||||||||||||||||||||||||||||||
| 540 | | [\$\@%&*]* [:\'\w]+ | ||||||||||||||||||||||||||||||||||||||||||
| 541 | (?: \\-> )? \(\s*[^\s,\)]*\s*\) # 0/1-arg func call | ||||||||||||||||||||||||||||||||||||||||||
| 542 | | (?: [+] || \\- )? ( \d[\d.]* | \.\d+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 543 | (?: [eE] (?: [+] || \\- )? \d+ )? # a number | ||||||||||||||||||||||||||||||||||||||||||
| 544 | | 0x [a-fA-F\d]+ # a hex constant | ||||||||||||||||||||||||||||||||||||||||||
| 545 | }xms; | ||||||||||||||||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||||||||||||||||
| 547 | m{ | ||||||||||||||||||||||||||||||||||||||||||
| 548 | ^\s* | ||||||||||||||||||||||||||||||||||||||||||
| 549 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 550 | ( [\'\"] ) .* \1 # already quoted | ||||||||||||||||||||||||||||||||||||||||||
| 551 | | \x{201C} .* \x{201D} # already quoted (Unicode) | ||||||||||||||||||||||||||||||||||||||||||
| 552 | | . \" # one character and double quote | ||||||||||||||||||||||||||||||||||||||||||
| 553 | | \\\*\(Aq .* \\\*\(Aq # quoted and escaped | ||||||||||||||||||||||||||||||||||||||||||
| 554 | | \\?\` .* ( \' | \\?\` | \\\*\(Aq ) # `quoted' or `quoted` | ||||||||||||||||||||||||||||||||||||||||||
| 555 | | $extra | ||||||||||||||||||||||||||||||||||||||||||
| 556 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 557 | \s*\z | ||||||||||||||||||||||||||||||||||||||||||
| 558 | 115 | ▶ | }xms and return '\f(FS' . $_ . '\f(FE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | # If we didn't return, go ahead and quote the text. | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 78 | return '\f(FS\*(C`' . $_ . "\\*(C'\\f(FE"; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | # Takes a text block to perform guesswork on. Returns the text block with | ||||||||||||||||||||||||||||||||||||||||||
| 565 | # formatting codes added. This is the code that marks up various Perl | ||||||||||||||||||||||||||||||||||||||||||
| 566 | # constructs and things commonly used in man pages without requiring the user | ||||||||||||||||||||||||||||||||||||||||||
| 567 | # to add any explicit markup, and is applied to all non-literal text. Note | ||||||||||||||||||||||||||||||||||||||||||
| 568 | # that the inserted font sequences must be treated later with mapfonts. | ||||||||||||||||||||||||||||||||||||||||||
| 569 | # | ||||||||||||||||||||||||||||||||||||||||||
| 570 | # This method is very fragile, both in the regular expressions it uses and in | ||||||||||||||||||||||||||||||||||||||||||
| 571 | # the ordering of those modifications. Care and testing is required when | ||||||||||||||||||||||||||||||||||||||||||
| 572 | # modifying it. | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 744 | ▶ | sub guesswork { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
guesswork: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 744 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 575 | 744 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | # Embolden functions in the form func(), including functions that are in | ||||||||||||||||||||||||||||||||||||||||||
| 578 | # all capitals, but don't embolden if there's anything inside the parens. | ||||||||||||||||||||||||||||||||||||||||||
| 579 | # The function must start with an alphabetic character or underscore and | ||||||||||||||||||||||||||||||||||||||||||
| 580 | # then consist of word characters or colons. | ||||||||||||||||||||||||||||||||||||||||||
| 581 | 744 | ▶ | if ($$self{GUESSWORK}{functions}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 582 | 717 | s{ | |||||||||||||||||||||||||||||||||||||||||
| 583 | (?<! \\ ) | ||||||||||||||||||||||||||||||||||||||||||
| 584 | \b | ||||||||||||||||||||||||||||||||||||||||||
| 585 | ( [A-Za-z_] [:\w]+ \(\) ) | ||||||||||||||||||||||||||||||||||||||||||
| 586 | } { | ||||||||||||||||||||||||||||||||||||||||||
| 587 | 12 | '\f(BS' . $1 . '\f(BE' | |||||||||||||||||||||||||||||||||||||||||
| 588 | }egx; | ||||||||||||||||||||||||||||||||||||||||||
| 589 | } | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | # Change references to manual pages to put the page name in bold but | ||||||||||||||||||||||||||||||||||||||||||
| 592 | # the number in the regular font, with a thin space between the name and | ||||||||||||||||||||||||||||||||||||||||||
| 593 | # the number. Only recognize func(n) where func starts with an alphabetic | ||||||||||||||||||||||||||||||||||||||||||
| 594 | # character or underscore and contains only word characters, periods (for | ||||||||||||||||||||||||||||||||||||||||||
| 595 | # configuration file man pages), or colons, and n is a single digit, | ||||||||||||||||||||||||||||||||||||||||||
| 596 | # optionally followed by some number of lowercase letters. Note that this | ||||||||||||||||||||||||||||||||||||||||||
| 597 | # does not recognize man page references like perl(l) or socket(3SOCKET). | ||||||||||||||||||||||||||||||||||||||||||
| 598 | 744 | ▶ | if ($$self{GUESSWORK}{manref}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 712 | s{ | |||||||||||||||||||||||||||||||||||||||||
| 600 | \b | ||||||||||||||||||||||||||||||||||||||||||
| 601 | (?<! \\ ) # rule out \e0(1) | ||||||||||||||||||||||||||||||||||||||||||
| 602 | ( [A-Za-z_] (?:[.:\w] | \\-)+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 603 | ( \( \d [a-z]* \) ) | ||||||||||||||||||||||||||||||||||||||||||
| 604 | } { | ||||||||||||||||||||||||||||||||||||||||||
| 605 | 10 | '\f(BS' . $1 . '\f(BE\|' . $2 | |||||||||||||||||||||||||||||||||||||||||
| 606 | }egx; | ||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | # Convert simple Perl variable references to a fixed-width font. Be | ||||||||||||||||||||||||||||||||||||||||||
| 610 | # careful not to convert functions, though; there are too many subtleties | ||||||||||||||||||||||||||||||||||||||||||
| 611 | # with them to want to perform this transformation. | ||||||||||||||||||||||||||||||||||||||||||
| 612 | 744 | ▶ | if ($$self{GUESSWORK}{variables}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 717 | s{ | |||||||||||||||||||||||||||||||||||||||||
| 614 | ( ^ | \s+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 615 | ( [\$\@%] [\w:]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 616 | (?! \( ) | ||||||||||||||||||||||||||||||||||||||||||
| 617 | } { | ||||||||||||||||||||||||||||||||||||||||||
| 618 | 13 | $1 . '\f(FS' . $2 . '\f(FE' | |||||||||||||||||||||||||||||||||||||||||
| 619 | }egx; | ||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | # Done. | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 744 | return $_; | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 627 | # Output | ||||||||||||||||||||||||||||||||||||||||||
| 628 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | # When building up the *roff code, we don't use real *roff fonts. Instead, we | ||||||||||||||||||||||||||||||||||||||||||
| 631 | # embed font codes of the form \f(<font>[SE] where <font> is one of B, I, or | ||||||||||||||||||||||||||||||||||||||||||
| 632 | # F, S stands for start, and E stands for end. This method turns these into | ||||||||||||||||||||||||||||||||||||||||||
| 633 | # the right start and end codes. | ||||||||||||||||||||||||||||||||||||||||||
| 634 | # | ||||||||||||||||||||||||||||||||||||||||||
| 635 | # We add this level of complexity because the old pod2man didn't get code like | ||||||||||||||||||||||||||||||||||||||||||
| 636 | # B<< someI<thing> else>> right. After I<> it switched back to normal text | ||||||||||||||||||||||||||||||||||||||||||
| 637 | # rather than bold. We take care of this by using variables that state | ||||||||||||||||||||||||||||||||||||||||||
| 638 | # whether bold, italic, or fixed are turned on as a combined pointer to our | ||||||||||||||||||||||||||||||||||||||||||
| 639 | # current font sequence, and set each to the number of current nestings of | ||||||||||||||||||||||||||||||||||||||||||
| 640 | # start tags for that font. | ||||||||||||||||||||||||||||||||||||||||||
| 641 | # | ||||||||||||||||||||||||||||||||||||||||||
| 642 | # The base font must be either \fP or \fR. \fP changes to the previous font, | ||||||||||||||||||||||||||||||||||||||||||
| 643 | # but only one previous font is kept. Unfortunately, there is a bug in | ||||||||||||||||||||||||||||||||||||||||||
| 644 | # Solaris 2.6 nroff (not present in GNU groff) where the sequence | ||||||||||||||||||||||||||||||||||||||||||
| 645 | # \fB\fP\f(CW\fP leaves the font set to B rather than R, presumably because | ||||||||||||||||||||||||||||||||||||||||||
| 646 | # \f(CW doesn't actually do a font change. Because of this, we prefer to use | ||||||||||||||||||||||||||||||||||||||||||
| 647 | # \fR where possible. | ||||||||||||||||||||||||||||||||||||||||||
| 648 | # | ||||||||||||||||||||||||||||||||||||||||||
| 649 | # Unfortunately, this isn't possible for arguments to heading macros, since | ||||||||||||||||||||||||||||||||||||||||||
| 650 | # there we don't know what the outside level font is. In that case, arrange | ||||||||||||||||||||||||||||||||||||||||||
| 651 | # things so that the outside font is always the "previous" font and end with | ||||||||||||||||||||||||||||||||||||||||||
| 652 | # \fP instead of \fR. Idea from Zack Weinberg. | ||||||||||||||||||||||||||||||||||||||||||
| 653 | # | ||||||||||||||||||||||||||||||||||||||||||
| 654 | # This function used to be much simpler outside of macro arguments because it | ||||||||||||||||||||||||||||||||||||||||||
| 655 | # went directly from \fB to \f(CW and relied on \f(CW clearing bold since it | ||||||||||||||||||||||||||||||||||||||||||
| 656 | # wasn't \f(CB. Unfortunately, while this works for mandoc, this is not how | ||||||||||||||||||||||||||||||||||||||||||
| 657 | # groff works; \fBfoo\f(CWbar still prints bar in bold. Therefore, we force | ||||||||||||||||||||||||||||||||||||||||||
| 658 | # the font back to the base font before each font change. | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 525 | ▶ | sub mapfonts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mapfonts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | 525 | my ($self, $text, $base) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | # The closure used to process each font escape, expected to be called from | ||||||||||||||||||||||||||||||||||||||||||
| 663 | # the right-hand side of an s/// expression. | ||||||||||||||||||||||||||||||||||||||||||
| 664 | 525 | my ($fixed, $bold, $italic) = (0, 0, 0); | |||||||||||||||||||||||||||||||||||||||||
| 665 | 525 | my %magic = (F => \$fixed, B => \$bold, I => \$italic); | |||||||||||||||||||||||||||||||||||||||||
| 666 | 525 | my $last = '\fR'; | |||||||||||||||||||||||||||||||||||||||||
| 667 | 438 | ▶ | my $process = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 438 | my ($style, $start_stop) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 669 | 438 | ▶ | my $sequence = ($last ne '\fR') ? $base : q{}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 670 | 438 | ▶ | ${ $magic{$style} } += ($start_stop eq 'S') ? 1 : -1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | 438 | ▶ | my $f = $self->{FONTS}{($fixed && 1) . ($bold && 1) . ($italic && 1)}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$fixed && 1
$bold && 1
$italic && 1
MC/DC100%1/1
$fixed && 1
$fixed
MC/DC100%1/1
$bold && 1
$bold
MC/DC100%1/1
$italic && 1
$italic
Truth table100%2/2
A
A= $fixed
Truth table100%2/2
A
A= $bold
Truth table100%2/2
A
A= $italic
| |||||||||||||||||||||||||||||||||||||||||||
| 672 | 438 | ▶ | return q{} if ($f eq $last); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 420 | ▶ | if ($f ne '\fR') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | 231 | $sequence .= $f; | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | 420 | $last = $f; | |||||||||||||||||||||||||||||||||||||||||
| 677 | 420 | return $sequence; | |||||||||||||||||||||||||||||||||||||||||
| 678 | 525 | }; | |||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||
| 680 | # Now, do the actual work. | ||||||||||||||||||||||||||||||||||||||||||
| 681 | 525 | $text =~ s{ \\f\((.)(.) }{$process->($1, $2)}xmsge; | |||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | # We can do a bit of cleanup by collapsing sequences like \fR\fB\fR\fI | ||||||||||||||||||||||||||||||||||||||||||
| 684 | # into just \fI. | ||||||||||||||||||||||||||||||||||||||||||
| 685 | 525 | $text =~ s{ (?: \\fR )? (?: \\f (.|\(..) \\fR )+ }{\\fR}xms; | |||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 525 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | # Given a command and a single argument that may or may not contain double | ||||||||||||||||||||||||||||||||||||||||||
| 691 | # quotes and fixed-width text, handle double-quote formatting for it. If | ||||||||||||||||||||||||||||||||||||||||||
| 692 | # there is no fixed-width text, just return the command followed by the | ||||||||||||||||||||||||||||||||||||||||||
| 693 | # argument with proper quoting. If there is fixed-width text, work around a | ||||||||||||||||||||||||||||||||||||||||||
| 694 | # Solaris nroff bug with fixed-width fonts by converting fixed-width to | ||||||||||||||||||||||||||||||||||||||||||
| 695 | # regular fonts (nroff sees no difference). | ||||||||||||||||||||||||||||||||||||||||||
| 696 | 122 | ▶ | sub switchquotes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
switchquotes: called CC=8 SCAR=21.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | 122 | my ($self, $command, $text, $extra) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | # Separate troff from nroff if there are any fixed-width fonts in use to | ||||||||||||||||||||||||||||||||||||||||||
| 700 | # work around problems with Solaris nroff. | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 122 | ▶ | if ($text =~ $self->{FIXEDPAT}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | 9 | my $nroff = $text; | |||||||||||||||||||||||||||||||||||||||||
| 703 | 9 | my $troff = $text; | |||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | # Work around the Solaris nroff bug where \f(CW\fP leaves the font set | ||||||||||||||||||||||||||||||||||||||||||
| 706 | # to Roman rather than the actual previous font when used in headings. | ||||||||||||||||||||||||||||||||||||||||||
| 707 | # troff output may still be broken, but at least we can fix nroff by | ||||||||||||||||||||||||||||||||||||||||||
| 708 | # just switching the font changes to the non-fixed versions. | ||||||||||||||||||||||||||||||||||||||||||
| 709 | 9 | my $font_end = qr{ (?: \\f[PR] | \Q$self->{FONTS}{100}\E ) }xms; | |||||||||||||||||||||||||||||||||||||||||
| 710 | 9 | $nroff =~ s{\Q$self->{FONTS}{100}\E(.*?)\\f([PR])}{$1}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 711 | 9 | $nroff =~ s{\Q$self->{FONTS}{101}\E}{\\fI}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 712 | 9 | $nroff =~ s{\Q$self->{FONTS}{110}\E}{\\fB}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 713 | 9 | $nroff =~ s{\Q$self->{FONTS}{111}\E}{\\f\(BI}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | # We have to deal with \*C` and \*C', which are used to add the quotes | ||||||||||||||||||||||||||||||||||||||||||
| 716 | # around C<> text, since they may expand to " and if they do this | ||||||||||||||||||||||||||||||||||||||||||
| 717 | # confuses the .SH macros and the like no end. Expand them ourselves. | ||||||||||||||||||||||||||||||||||||||||||
| 718 | 9 | my $c_is_quote = index("$self->{LQUOTE}$self->{RQUOTE}", qq(\")) != -1; | |||||||||||||||||||||||||||||||||||||||||
| 719 | 9 | ▶ | if ($c_is_quote && $text =~ m{ \\[*]\(C[\'\`] }xms) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$c_is_quote and $text =~ / \\[*]\(C[\'\`] /msux
MC/DC0%0/2
$c_is_quote and $text =~ / \\[*]\(C[\'\`] /msux
$c_is_quote
$text =~ / \\[*]\(C[\'\`] /msux
Truth table33%1/3
A and B
A= $c_is_quoteB= $text =~ / \\[*]\(C[\'\`] /msux
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 9 | $nroff =~ s{ \\[*]\(C\` }{$self->{LQUOTE}}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 721 | 9 | $nroff =~ s{ \\[*]\(C\' }{$self->{RQUOTE}}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 722 | 9 | $troff =~ s{ \\[*]\(C[\'\`] }{}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 723 | } | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | # Now finally output the command. Bother with .ie only if the nroff | ||||||||||||||||||||||||||||||||||||||||||
| 726 | # and troff output aren't the same. | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 9 | ▶ | $nroff = _quote_macro_argument($nroff) . ($extra ? " $extra" : ''); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | 9 | ▶ | $troff = _quote_macro_argument($troff) . ($extra ? " $extra" : ''); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | 9 | ▶ | if ($nroff ne $troff) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | 9 | return ".ie n $command $nroff\n.el $command $troff\n"; | |||||||||||||||||||||||||||||||||||||||||
| 731 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | return "$command $nroff\n"; | |||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 734 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 735 | 113 | ▶ | $text = _quote_macro_argument($text) . ($extra ? " $extra" : ''); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 736 | 113 | return "$command $text\n"; | |||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | # Protect leading quotes and periods against interpretation as commands. Also | ||||||||||||||||||||||||||||||||||||||||||
| 741 | # protect anything starting with a backslash, since it could expand or hide | ||||||||||||||||||||||||||||||||||||||||||
| 742 | # something that *roff would interpret as a command. This is overkill, but | ||||||||||||||||||||||||||||||||||||||||||
| 743 | # it's much simpler than trying to parse *roff here. | ||||||||||||||||||||||||||||||||||||||||||
| 744 | 395 | ▶ | sub protect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
protect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | 395 | my ($self, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 746 | 395 | $text =~ s/^([.\'\\])/\\&$1/mg; | |||||||||||||||||||||||||||||||||||||||||
| 747 | 395 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | # Make vertical whitespace if NEEDSPACE is set, appropriate to the indentation | ||||||||||||||||||||||||||||||||||||||||||
| 751 | # level the situation. This function is needed since in *roff one has to | ||||||||||||||||||||||||||||||||||||||||||
| 752 | # create vertical whitespace after paragraphs and between some things, but | ||||||||||||||||||||||||||||||||||||||||||
| 753 | # other macros create their own whitespace. Also close out a sequence of | ||||||||||||||||||||||||||||||||||||||||||
| 754 | # repeated =items, since calling makespace means we're about to begin the item | ||||||||||||||||||||||||||||||||||||||||||
| 755 | # body. | ||||||||||||||||||||||||||||||||||||||||||
| 756 | 361 | ▶ | sub makespace { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makespace: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 757 | 361 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 758 | 361 | ▶ | $self->output (".PD\n") if $$self{ITEMS} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 361 | $$self{ITEMS} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 760 | $self->output ($$self{INDENT} > 0 ? ".Sp\n" : ".PP\n") | ||||||||||||||||||||||||||||||||||||||||||
| 761 | 361 | ▶ | if $$self{NEEDSPACE}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | # Output any pending index entries, and optionally an index entry given as an | ||||||||||||||||||||||||||||||||||||||||||
| 765 | # argument. Support multiple index entries in X<> separated by slashes, and | ||||||||||||||||||||||||||||||||||||||||||
| 766 | # strip special escapes from index entries. | ||||||||||||||||||||||||||||||||||||||||||
| 767 | 488 | ▶ | sub outindex { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
outindex: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 768 | 488 | my ($self, $section, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 769 | 488 | my @entries = map { split m%\s*/\s*% } @{ $$self{INDEX} }; | |||||||||||||||||||||||||||||||||||||||||
| 770 | 488 | ▶ | return unless ($section || @entries); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$section or @entries
MC/DC100%2/2
$section or @entries
$section
@entries
Truth table100%3/3
A or B
A= $sectionB= @entries
| |||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | # We're about to output all pending entries, so clear our pending queue. | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 141 | $$self{INDEX} = []; | |||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | # Build the output. Regular index entries are marked Xref, and headings | ||||||||||||||||||||||||||||||||||||||||||
| 776 | # pass in their own section. Undo some *roff formatting on headings. | ||||||||||||||||||||||||||||||||||||||||||
| 777 | 141 | my @output; | |||||||||||||||||||||||||||||||||||||||||
| 778 | 141 | ▶ | if (@entries) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 779 | 5 | push @output, [ 'Xref', join (' ', @entries) ]; | |||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||
| 781 | 141 | ▶ | if ($section) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 782 | 136 | $index =~ s/\\-/-/g; | |||||||||||||||||||||||||||||||||||||||||
| 783 | 136 | $index =~ s/\\\`/\`/g; | |||||||||||||||||||||||||||||||||||||||||
| 784 | 136 | $index =~ s/\\[*]\(Aq/\'/g; | |||||||||||||||||||||||||||||||||||||||||
| 785 | 136 | $index =~ s/\\(?:.\(..|.)//g; | |||||||||||||||||||||||||||||||||||||||||
| 786 | 136 | push @output, [ $section, $index ]; | |||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | # Print out the .IX commands. | ||||||||||||||||||||||||||||||||||||||||||
| 790 | 141 | for (@output) { | |||||||||||||||||||||||||||||||||||||||||
| 791 | 141 | my ($type, $entry) = @$_; | |||||||||||||||||||||||||||||||||||||||||
| 792 | 141 | $entry =~ s/\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 793 | 141 | $entry =~ s/\"/\"\"/g; | |||||||||||||||||||||||||||||||||||||||||
| 794 | 141 | $entry =~ s/\\/\\\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 795 | 141 | $self->output (".IX $type " . '"' . $entry . '"' . "\n"); | |||||||||||||||||||||||||||||||||||||||||
| 796 | } | ||||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | # Output some text, without any additional changes. | ||||||||||||||||||||||||||||||||||||||||||
| 800 | 1646 | ▶ | sub output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 801 | 1646 | my ($self, @text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 802 | 1646 | my $text = join('', @text); | |||||||||||||||||||||||||||||||||||||||||
| 803 | 1646 | $text =~ s{$NBSP}{\\ }xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 804 | 1646 | $text =~ s{$SHY}{\\%}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | 1646 | ▶ | if ($$self{ENCODE} && _needs_encode($$self{ENCODING})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"ENCODE"} and _needs_encode($self->{"ENCODING"})
MC/DC100%2/2
$self->{"ENCODE"} and _needs_encode($self->{"ENCODING"})
$self->{"ENCODE"}
_needs_encode($self->{"ENCODING"})
Truth table100%3/3
A and B
A= $self->{"ENCODE"}B= _needs_encode($self->{"ENCODING"})
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | 2 | ▶ | my $check = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | 2 | my ($char) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 809 | 2 | my $display = '"\x{' . hex($char) . '}"'; | |||||||||||||||||||||||||||||||||||||||||
| 810 | 2 | my $error = "$display does not map to $$self{ENCODING}"; | |||||||||||||||||||||||||||||||||||||||||
| 811 | 2 | $self->whine ($self->line_count(), $error); | |||||||||||||||||||||||||||||||||||||||||
| 812 | 2 | return Encode::encode ($$self{ENCODING}, chr($char)); | |||||||||||||||||||||||||||||||||||||||||
| 813 | 1490 | }; | |||||||||||||||||||||||||||||||||||||||||
| 814 | 1490 | my $output = Encode::encode ($$self{ENCODING}, $text, $check); | |||||||||||||||||||||||||||||||||||||||||
| 815 | 1490 | print { $$self{output_fh} } $output; | |||||||||||||||||||||||||||||||||||||||||
| 816 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 817 | 156 | print { $$self{output_fh} } $text; | |||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 822 | # Document initialization | ||||||||||||||||||||||||||||||||||||||||||
| 823 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||
| 825 | # Handle the start of the document. Here we handle empty documents, as well | ||||||||||||||||||||||||||||||||||||||||||
| 826 | # as setting up our basic macros in a preamble and building the page title. | ||||||||||||||||||||||||||||||||||||||||||
| 827 | 81 | ▶ | sub start_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 81 | my ($self, $attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 829 | 81 | ▶ | if ($$attrs{contentless} && !$$self{ALWAYS_EMIT_SOMETHING}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$attrs->{"contentless"} and not $self->{"ALWAYS_EMIT_SOMETHING"}
MC/DC50%1/2
$attrs->{"contentless"} and not $self->{"ALWAYS_EMIT_SOMETHING"}
$attrs->{"contentless"}
not $self->{"ALWAYS_EMIT_SOMETHING"}
Truth table66%2/3
A and not(B)
A= $attrs->{"contentless"}B= not $self->{"ALWAYS_EMIT_SOMETHING"}
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | 1 | $$self{CONTENTLESS} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 831 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 832 | 80 | delete $$self{CONTENTLESS}; | |||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||
| 835 | # When an encoding is requested, check whether our output file handle | ||||||||||||||||||||||||||||||||||||||||||
| 836 | # already has a PerlIO encoding layer set. If it does not, we'll need to | ||||||||||||||||||||||||||||||||||||||||||
| 837 | # encode our output before printing it (handled in the output() sub). | ||||||||||||||||||||||||||||||||||||||||||
| 838 | # Wrap the check in an eval to handle versions of Perl without PerlIO. | ||||||||||||||||||||||||||||||||||||||||||
| 839 | # | ||||||||||||||||||||||||||||||||||||||||||
| 840 | # PerlIO::get_layers still requires its argument be a glob, so coerce the | ||||||||||||||||||||||||||||||||||||||||||
| 841 | # file handle to a glob. | ||||||||||||||||||||||||||||||||||||||||||
| 842 | 81 | $$self{ENCODE} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 843 | 81 | ▶ | if ($$self{ENCODING}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 844 | 81 | $$self{ENCODE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 845 | 81 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 846 | 81 | require PerlIO; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 81 | my @options = (output => 1, details => 1); | |||||||||||||||||||||||||||||||||||||||||
| 848 | 81 | my @layers = PerlIO::get_layers (*{$$self{output_fh}}, @options); | |||||||||||||||||||||||||||||||||||||||||
| 849 | 81 | ▶ | if ($layers[-1] && ($layers[-1] & PerlIO::F_UTF8 ())) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$layers[-1] and $layers[-1] & &PerlIO::F_UTF8()
MC/DC100%2/2
$layers[-1] and $layers[-1] & &PerlIO::F_UTF8()
$layers[-1]
$layers[-1] & &PerlIO::F_UTF8()
Truth table100%3/3
A and B
A= $layers[-1]B= $layers[-1] & &PerlIO::F_UTF8()
| |||||||||||||||||||||||||||||||||||||||||||
| 850 | 3 | $$self{ENCODE} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||
| 853 | } | ||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | # Determine information for the preamble and then output it unless the | ||||||||||||||||||||||||||||||||||||||||||
| 856 | # document was content-free. | ||||||||||||||||||||||||||||||||||||||||||
| 857 | 81 | ▶ | if (!$$self{CONTENTLESS}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 858 | 80 | my ($name, $section); | |||||||||||||||||||||||||||||||||||||||||
| 859 | 80 | ▶ | if (defined $self->{opt_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 860 | 70 | $name = $self->{opt_name}; | |||||||||||||||||||||||||||||||||||||||||
| 861 | 70 | ▶ | $section = $self->{opt_section} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'opt_section'} || 1
MC/DC100%1/1
$self->{'opt_section'} || 1
$self->{'opt_section'}
Truth table100%2/2
A
A= $self->{'opt_section'}
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 10 | ($name, $section) = $self->devise_title; | |||||||||||||||||||||||||||||||||||||||||
| 864 | } | ||||||||||||||||||||||||||||||||||||||||||
| 865 | 80 | ▶ | my $date = $self->{opt_date} // $self->devise_date(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"opt_date"} // $self->devise_date
MC/DC0%0/2
$self->{"opt_date"} // $self->devise_date
$self->{"opt_date"}
$self->devise_date
Truth table66%2/3
A // B
A= $self->{"opt_date"}B= $self->devise_date
| |||||||||||||||||||||||||||||||||||||||||||
| 866 | 80 | ▶ | $self->preamble ($name, $section, $date) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | unless $self->bare_output; | ||||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | # Initialize a few per-document variables. | ||||||||||||||||||||||||||||||||||||||||||
| 871 | 81 | $$self{INDENT} = 0; # Current indentation level. | |||||||||||||||||||||||||||||||||||||||||
| 872 | 81 | $$self{INDENTS} = []; # Stack of indentations. | |||||||||||||||||||||||||||||||||||||||||
| 873 | 81 | $$self{INDEX} = []; # Index keys waiting to be printed. | |||||||||||||||||||||||||||||||||||||||||
| 874 | 81 | $$self{IN_NAME} = 0; # Whether processing the NAME section. | |||||||||||||||||||||||||||||||||||||||||
| 875 | 81 | $$self{ITEMS} = 0; # The number of consecutive =items. | |||||||||||||||||||||||||||||||||||||||||
| 876 | 81 | $$self{ITEMTYPES} = []; # Stack of =item types, one per list. | |||||||||||||||||||||||||||||||||||||||||
| 877 | 81 | $$self{SHIFTWAIT} = 0; # Whether there is a shift waiting. | |||||||||||||||||||||||||||||||||||||||||
| 878 | 81 | $$self{SHIFTS} = []; # Stack of .RS shifts. | |||||||||||||||||||||||||||||||||||||||||
| 879 | 81 | $$self{PENDING} = [[]]; # Pending output. | |||||||||||||||||||||||||||||||||||||||||
| 880 | } | ||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | # Handle the end of the document. This handles dying on POD errors, since | ||||||||||||||||||||||||||||||||||||||||||
| 883 | # Pod::Parser currently doesn't. Otherwise, does nothing but print out a | ||||||||||||||||||||||||||||||||||||||||||
| 884 | # final comment at the end of the document under debugging. | ||||||||||||||||||||||||||||||||||||||||||
| 885 | 81 | ▶ | sub end_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | 81 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 887 | 81 | ▶ | if ($$self{complain_die} && $self->errors_seen) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"complain_die"} and $self->errors_seen
MC/DC50%1/2
$self->{"complain_die"} and $self->errors_seen
$self->{"complain_die"}
$self->errors_seen
Truth table66%2/3
A and B
A= $self->{"complain_die"}B= $self->errors_seen
| |||||||||||||||||||||||||||||||||||||||||||
| 888 | 2 | croak ("POD document had syntax errors"); | |||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||
| 890 | 79 | ▶ | return if $self->bare_output; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | 79 | ▶ | return if ($$self{CONTENTLESS} && !$$self{ALWAYS_EMIT_SOMETHING}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"CONTENTLESS"} and not $self->{"ALWAYS_EMIT_SOMETHING"}
MC/DC50%1/2
$self->{"CONTENTLESS"} and not $self->{"ALWAYS_EMIT_SOMETHING"}
$self->{"CONTENTLESS"}
not $self->{"ALWAYS_EMIT_SOMETHING"}
Truth table66%2/3
A and not(B)
A= $self->{"CONTENTLESS"}B= not $self->{"ALWAYS_EMIT_SOMETHING"}
| |||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||
| 894 | # Try to figure out the name and section from the file name and return them as | ||||||||||||||||||||||||||||||||||||||||||
| 895 | # a list, returning an empty name and section 1 if we can't find any better | ||||||||||||||||||||||||||||||||||||||||||
| 896 | # information. Uses File::Basename and File::Spec as necessary. | ||||||||||||||||||||||||||||||||||||||||||
| 897 | 12 | ▶ | sub devise_title { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
devise_title: called CC=21 SCAR=46.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | 12 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 899 | 12 | ▶ | my $name = $self->source_filename || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->source_filename || ''
MC/DC100%1/1
$self->source_filename || ''
$self->source_filename
Truth table100%2/2
A
A= $self->source_filename
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 12 | ▶ | my $section = $self->{opt_section} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'opt_section'} || 1
MC/DC0%0/1
$self->{'opt_section'} || 1
$self->{'opt_section'}
Truth table50%1/2
A
A= $self->{'opt_section'}
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | 12 | ▶ | $section = 3 if (!$self->{opt_section} && $name =~ /\.pm\z/i); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $self->{"opt_section"} and $name =~ /\.pm\z/iu
MC/DC50%1/2
not $self->{"opt_section"} and $name =~ /\.pm\z/iu
not $self->{"opt_section"}
$name =~ /\.pm\z/iu
Truth table66%2/3
not(A) and B
A= not $self->{"opt_section"}B= $name =~ /\.pm\z/iu
| |||||||||||||||||||||||||||||||||||||||||||
| 902 | 12 | $name =~ s/\.p(od|[lm])\z//i; | |||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | # If Pod::Parser gave us an IO::File reference as the source file name, | ||||||||||||||||||||||||||||||||||||||||||
| 905 | # convert that to the empty string as well. Then, if we don't have a | ||||||||||||||||||||||||||||||||||||||||||
| 906 | # valid name, convert it to STDIN. | ||||||||||||||||||||||||||||||||||||||||||
| 907 | # | ||||||||||||||||||||||||||||||||||||||||||
| 908 | # In podlators 4.00 through 4.07, this also produced a warning, but that | ||||||||||||||||||||||||||||||||||||||||||
| 909 | # was surprising to a lot of programs that had expected to be able to pipe | ||||||||||||||||||||||||||||||||||||||||||
| 910 | # POD through pod2man without specifying the name. In the name of | ||||||||||||||||||||||||||||||||||||||||||
| 911 | # backward compatibility, just quietly set STDIN as the page title. | ||||||||||||||||||||||||||||||||||||||||||
| 912 | 12 | ▶ | if ($name =~ /^IO::File(?:=\w+)\(0x[\da-f]+\)$/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 2 | $name = ''; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | 12 | ▶ | if ($name eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 916 | 5 | $name = 'STDIN'; | |||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||
| 919 | # If the section isn't 3, then the name defaults to just the basename of | ||||||||||||||||||||||||||||||||||||||||||
| 920 | # the file. | ||||||||||||||||||||||||||||||||||||||||||
| 921 | 12 | ▶ | if ($section !~ /^3/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 922 | 11 | require File::Basename; | |||||||||||||||||||||||||||||||||||||||||
| 923 | 11 | $name = uc File::Basename::basename ($name); | |||||||||||||||||||||||||||||||||||||||||
| 924 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 925 | 1 | require File::Spec; | |||||||||||||||||||||||||||||||||||||||||
| 926 | 1 | my ($volume, $dirs, $file) = File::Spec->splitpath ($name); | |||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | # Otherwise, assume we're dealing with a module. We want to figure | ||||||||||||||||||||||||||||||||||||||||||
| 929 | # out the full module name from the path to the file, but we don't | ||||||||||||||||||||||||||||||||||||||||||
| 930 | # want to include too much of the path into the module name. Lose | ||||||||||||||||||||||||||||||||||||||||||
| 931 | # anything up to the first of: | ||||||||||||||||||||||||||||||||||||||||||
| 932 | # | ||||||||||||||||||||||||||||||||||||||||||
| 933 | # */lib/*perl*/ standard or site_perl module | ||||||||||||||||||||||||||||||||||||||||||
| 934 | # */*perl*/lib/ from -Dprefix=/opt/perl | ||||||||||||||||||||||||||||||||||||||||||
| 935 | # */*perl*/ random module hierarchy | ||||||||||||||||||||||||||||||||||||||||||
| 936 | # | ||||||||||||||||||||||||||||||||||||||||||
| 937 | # Also strip off a leading site, site_perl, or vendor_perl component, | ||||||||||||||||||||||||||||||||||||||||||
| 938 | # any OS-specific component, and any version number component, and | ||||||||||||||||||||||||||||||||||||||||||
| 939 | # strip off an initial component of "lib" or "blib/lib" since that's | ||||||||||||||||||||||||||||||||||||||||||
| 940 | # what ExtUtils::MakeMaker creates. | ||||||||||||||||||||||||||||||||||||||||||
| 941 | # | ||||||||||||||||||||||||||||||||||||||||||
| 942 | # splitdir requires at least File::Spec 0.8. | ||||||||||||||||||||||||||||||||||||||||||
| 943 | 1 | my @dirs = File::Spec->splitdir ($dirs); | |||||||||||||||||||||||||||||||||||||||||
| 944 | 1 | ▶ | if (@dirs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | my $cut = 0; | |||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | my $i; | |||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | ▶ | for ($i = 0; $i < @dirs; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | if ($dirs[$i] =~ /perl/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $cut = $i + 1; | |||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | ▶ | $cut++ if ($dirs[$i + 1] && $dirs[$i + 1] eq 'lib'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dirs[$i + 1] and $dirs[$i + 1] eq "lib"
MC/DC0%0/2
$dirs[$i + 1] and $dirs[$i + 1] eq "lib"
$dirs[$i + 1]
$dirs[$i + 1] eq "lib"
Truth table0%0/3
A and B
A= $dirs[$i + 1]B= $dirs[$i + 1] eq "lib"
| |||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | if ($cut > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | splice (@dirs, 0, $cut); | |||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | ▶ | shift @dirs if ($dirs[0] =~ /^(site|vendor)(_perl)?$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | shift @dirs if ($dirs[0] =~ /^[\d.]+$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | ▶ | shift @dirs if ($dirs[0] =~ /^(.*-$^O|$^O-.*|$^O)$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | ▶ | shift @dirs if $dirs[0] eq 'lib'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 961 | 0 | ▶ | splice (@dirs, 0, 2) if ($dirs[0] eq 'blib' && $dirs[1] eq 'lib'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$dirs[0] eq "blib" and $dirs[1] eq "lib"
MC/DC0%0/2
$dirs[0] eq "blib" and $dirs[1] eq "lib"
$dirs[0] eq "blib"
$dirs[1] eq "lib"
Truth table0%0/3
A and B
A= $dirs[0] eq "blib"B= $dirs[1] eq "lib"
| |||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||
| 964 | # Remove empty directories when building the module name; they | ||||||||||||||||||||||||||||||||||||||||||
| 965 | # occur too easily on Unix by doubling slashes. | ||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | ▶ | $name = join ('::', (grep { $_ ? $_ : () } @dirs), $file); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||
| 968 | 12 | return ($name, $section); | |||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | # Determine the modification date and return that, properly formatted in ISO | ||||||||||||||||||||||||||||||||||||||||||
| 972 | # format. | ||||||||||||||||||||||||||||||||||||||||||
| 973 | # | ||||||||||||||||||||||||||||||||||||||||||
| 974 | # If POD_MAN_DATE is set, that overrides anything else. This can be used for | ||||||||||||||||||||||||||||||||||||||||||
| 975 | # reproducible generation of the same file even if the input file timestamps | ||||||||||||||||||||||||||||||||||||||||||
| 976 | # are unpredictable or the POD comes from standard input. | ||||||||||||||||||||||||||||||||||||||||||
| 977 | # | ||||||||||||||||||||||||||||||||||||||||||
| 978 | # Otherwise, if SOURCE_DATE_EPOCH is set and can be parsed as seconds since | ||||||||||||||||||||||||||||||||||||||||||
| 979 | # the UNIX epoch, base the timestamp on that. See | ||||||||||||||||||||||||||||||||||||||||||
| 980 | # <https://reproducible-builds.org/specs/source-date-epoch/> | ||||||||||||||||||||||||||||||||||||||||||
| 981 | # | ||||||||||||||||||||||||||||||||||||||||||
| 982 | # Otherwise, use the modification date of the input if we can stat it. Be | ||||||||||||||||||||||||||||||||||||||||||
| 983 | # aware that Pod::Simple returns the stringification of the file handle as | ||||||||||||||||||||||||||||||||||||||||||
| 984 | # source_filename for input from a file handle, so we'll stat some random ref | ||||||||||||||||||||||||||||||||||||||||||
| 985 | # string in that case. If that fails, instead use the current time. | ||||||||||||||||||||||||||||||||||||||||||
| 986 | # | ||||||||||||||||||||||||||||||||||||||||||
| 987 | # $self - Pod::Man object, used to get the source file | ||||||||||||||||||||||||||||||||||||||||||
| 988 | # | ||||||||||||||||||||||||||||||||||||||||||
| 989 | # Returns: YYYY-MM-DD date suitable for the left-hand footer | ||||||||||||||||||||||||||||||||||||||||||
| 990 | 82 | ▶ | sub devise_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
devise_date: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 991 | 82 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||
| 993 | # If POD_MAN_DATE is set, always use it. | ||||||||||||||||||||||||||||||||||||||||||
| 994 | 82 | ▶ | if (defined($ENV{POD_MAN_DATE})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 995 | 3 | return $ENV{POD_MAN_DATE}; | |||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||
| 998 | # If SOURCE_DATE_EPOCH is set and can be parsed, use that. | ||||||||||||||||||||||||||||||||||||||||||
| 999 | 79 | my $time; | |||||||||||||||||||||||||||||||||||||||||
| 1000 | 79 | ▶ | if (defined($ENV{SOURCE_DATE_EPOCH}) && $ENV{SOURCE_DATE_EPOCH} !~ /\D/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ENV{"SOURCE_DATE_EPOCH"} and not $ENV{"SOURCE_DATE_EPOCH"} =~ /\D/u
MC/DC100%2/2
defined $ENV{"SOURCE_DATE_EPOCH"} and not $ENV{"SOURCE_DATE_EPOCH"} =~ /\D/u
defined $ENV{"SOURCE_DATE_EPOCH"}
not $ENV{"SOURCE_DATE_EPOCH"} =~ /\D/u
Truth table100%3/3
A and not(B)
A= defined $ENV{"SOURCE_DATE_EPOCH"}B= not $ENV{"SOURCE_DATE_EPOCH"} =~ /\D/u
| |||||||||||||||||||||||||||||||||||||||||||
| 1001 | 4 | $time = $ENV{SOURCE_DATE_EPOCH}; | |||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | # Otherwise, get the input filename and try to stat it. If that fails, | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | # use the current time. | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | 79 | ▶ | if (!defined $time) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | 75 | my $input = $self->source_filename; | |||||||||||||||||||||||||||||||||||||||||
| 1008 | 75 | ▶ | if ($input) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1009 | 11 | ▶ | $time = (stat($input))[9] || time(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
(stat $input)[9] || time
MC/DC100%1/1
(stat $input)[9] || time
(stat $input)[9]
Truth table100%2/2
A
A= (stat $input)[9]
| |||||||||||||||||||||||||||||||||||||||||||
| 1010 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | 64 | $time = time(); | |||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | # Can't use POSIX::strftime(), which uses Fcntl, because MakeMaker uses | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | # this and it has to work in the core which can't load dynamic libraries. | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | # Use gmtime instead of localtime so that the generated man page does not | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | # depend on the local time zone setting and is more reproducible | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | 79 | my ($year, $month, $day) = (gmtime($time))[5,4,3]; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | 79 | return sprintf("%04d-%02d-%02d", $year + 1900, $month + 1, $day); | |||||||||||||||||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||
| 1023 | # Print out the preamble and the title. The meaning of the arguments to .TH | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | # unfortunately vary by system; some systems consider the fourth argument to | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | # be a "source" and others use it as a version number. Generally it's just | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | # presented as the left-side footer, though, so it doesn't matter too much if | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | # a particular system gives it another interpretation. | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1029 | # The order of date and release used to be reversed in older versions of this | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | # module, but this order is correct for both Solaris and Linux. | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | 80 | ▶ | sub preamble { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preamble: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 80 | my ($self, $name, $section, $date) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | 80 | my $preamble = $self->preamble_template(); | |||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | # groff's preconv script will use this line to correctly determine the | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | # input encoding if the encoding is one of the ones it recognizes. It | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | # must be the first or second line. | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | # If the output encoding is some version of Unicode, we could also add a | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | # Unicode Byte Order Mark to the start of the file, but the BOM is now | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | # deprecated and I am concerned that may break a *roff implementation that | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | # might otherwise cope with Unicode. Revisit this if someone files a bug | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | # report about it. | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | 80 | ▶ | if (_needs_encode($$self{ENCODING})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1045 | 69 | my $normalized = lc($$self{ENCODING}); | |||||||||||||||||||||||||||||||||||||||||
| 1046 | 69 | $normalized =~ s{-}{}g; | |||||||||||||||||||||||||||||||||||||||||
| 1047 | 69 | ▶ | my $coding = $ENCODINGS{$normalized} || lc($$self{ENCODING}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ENCODINGS{$normalized} || lc $self->{'ENCODING'}
MC/DC0%0/2
$ENCODINGS{$normalized} || lc $self->{'ENCODING'}
$ENCODINGS{$normalized}
lc $self->{'ENCODING'}
Truth table33%1/3
A || B
A= $ENCODINGS{$normalized}B= lc $self->{'ENCODING'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1048 | 69 | ▶ | if ($coding ne 'us-ascii') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1049 | 69 | $self->output(qq{.\\\" -*- mode: troff; coding: $coding -*-\n}); | |||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||
| 1053 | # Substitute into the preamble the configuration options. Because it's | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | # used as the argument to defining a string, any leading double quote (but | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | # no other double quotes) in LQUOTE and RQUOTE has to be doubled. | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | 80 | $preamble =~ s{ [@] CFONT [@] }{$self->{opt_fixed}}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 80 | my $lquote = $self->{LQUOTE}; | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 80 | my $rquote = $self->{RQUOTE}; | |||||||||||||||||||||||||||||||||||||||||
| 1059 | 80 | $lquote =~ s{ \A \" }{""}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1060 | 80 | $rquote =~ s{ \A \" }{""}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1061 | 80 | $preamble =~ s{ [@] LQUOTE [@] }{$lquote}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1062 | 80 | $preamble =~ s{ [@] RQUOTE [@] }{$rquote}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | 80 | chomp($preamble); | |||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | # Get the version information. | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | 80 | my $version = $self->version_report(); | |||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | # Build the index line and make sure that it will be syntactically valid. | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | 80 | my $index = _quote_macro_argument("$name $section"); | |||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||
| 1071 | # Quote the arguments to the .TH macro. (Section should never require | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | # this, but we may as well be cautious.) | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | 80 | $name = _quote_macro_argument($name); | |||||||||||||||||||||||||||||||||||||||||
| 1074 | 80 | $section = _quote_macro_argument($section); | |||||||||||||||||||||||||||||||||||||||||
| 1075 | 80 | $date = _quote_macro_argument($date); | |||||||||||||||||||||||||||||||||||||||||
| 1076 | 80 | my $center = _quote_macro_argument($self->{opt_center}); | |||||||||||||||||||||||||||||||||||||||||
| 1077 | 80 | my $release = _quote_macro_argument($self->{opt_release}); | |||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | # Output the majority of the preamble. | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | 80 | $self->output (<<"----END OF HEADER----"); | |||||||||||||||||||||||||||||||||||||||||
| 1081 | .\\" Automatically generated by $version | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | .\\" | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | .\\" Standard preamble: | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | .\\" ======================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | $preamble | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | .\\" ======================================================================== | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | .\\" | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | .IX Title $index | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | .TH $name $section $date $release $center | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | .\\" For nroff, turn off justification. Always turn off hyphenation. String | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | .\\" and register settings are required by groff 1.23.0 and later. Changing | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | .\\" tag separation back to 1n is required by groff 1.24.0 and later. | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | .if n .ds AD l | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | .if n .ad l | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | .nr HY 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | .nh | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | ----END OF HEADER---- | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | #"# unconfuse Emacs cperl-mode | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | # If the language was specified, output the language configuration. | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 80 | ▶ | if ($self->{opt_language}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 1 | $self->output(".mso $self->{opt_language}.tmac\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1103 | 1 | $self->output(".hla $self->{opt_language}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | # Text blocks | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | # Handle a basic block of text. The only tricky part of this is if this is | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | # the first paragraph of text after an =over, in which case we have to change | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | # indentations for *roff. | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | 318 | ▶ | sub cmd_para { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_para: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1115 | 318 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1116 | 318 | my $line = $$attrs{start_line}; | |||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||
| 1118 | # Output the paragraph. We also have to handle =over without =item. If | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | # there's an =over without =item, SHIFTWAIT will be set, and we need to | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | # handle creation of the indent here. Add the shift to SHIFTS so that it | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | # will be cleaned up on =back. | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | 318 | $self->makespace; | |||||||||||||||||||||||||||||||||||||||||
| 1123 | 318 | ▶ | if ($$self{SHIFTWAIT}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1124 | 4 | $self->output (".RS $$self{INDENT}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1125 | 4 | push (@{ $$self{SHIFTS} }, $$self{INDENT}); | |||||||||||||||||||||||||||||||||||||||||
| 1126 | 4 | $$self{SHIFTWAIT} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | # Force exactly one newline at the end and strip unwanted trailing | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | # whitespace at the end, but leave Unicode whitespace (which includes the | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | # nonbreaking spaces from S<>). Reverse the text first, to avoid having | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | # to scan the entire paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | 318 | $text = reverse $text; | |||||||||||||||||||||||||||||||||||||||||
| 1134 | 318 | $text =~ s{ \A [ \t\n]* }{\n}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1135 | 318 | $text = reverse $text; | |||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | # Output the paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | 318 | $self->output($self->protect($self->mapfonts($text, '\fR'))); | |||||||||||||||||||||||||||||||||||||||||
| 1139 | 318 | $self->outindex(); | |||||||||||||||||||||||||||||||||||||||||
| 1140 | 318 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 318 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | # Handle a verbatim paragraph. Put a null token at the beginning of each line | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | # to protect against commands and wrap in .Vb/.Ve (which we define in our | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | # prelude). | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | 15 | ▶ | sub cmd_verbatim { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_verbatim: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1148 | 15 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | # Ignore an empty verbatim paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | 15 | ▶ | return if $text !~ m{ \S }xms; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||
| 1153 | # Force exactly one newline at the end and strip unwanted trailing | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | # whitespace at the end. | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | 15 | $text =~ s{ \s* \z }{\n}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | # Get a count of the number of lines before the first blank line, which | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | # we'll pass to .Vb as its parameter. This tells *roff to keep that many | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | # lines together. We don't want to tell *roff to keep huge blocks | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | # together. | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | 15 | my @lines = split (m{ \n }xms, $text); | |||||||||||||||||||||||||||||||||||||||||
| 1162 | 15 | my $unbroken = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1163 | 15 | for my $line (@lines) { | |||||||||||||||||||||||||||||||||||||||||
| 1164 | 67 | ▶ | last if $line =~ m{ \A \s* \z }xms; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1165 | 63 | $unbroken++; | |||||||||||||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | 15 | ▶ | if ($unbroken > 12) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | $unbroken = 10; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | # Prepend a null token to each line to preserve indentation. | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | 15 | $text =~ s{ ^ }{\\&}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||
| 1174 | # Output the results. | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | 15 | $self->makespace(); | |||||||||||||||||||||||||||||||||||||||||
| 1176 | 15 | $self->output(".Vb $unbroken\n$text.Ve\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1177 | 15 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1178 | 15 | return q{}; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | # Handle literal text (produced by =for and similar constructs). Just output | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | # it with the minimum of changes. | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | 4 | ▶ | sub cmd_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_data: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1184 | 4 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1185 | 4 | $text =~ s{ \A \n+ }{}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 4 | $text =~ s{ \n{0,2} \z }{\n}xms; | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 4 | $self->output($text); | |||||||||||||||||||||||||||||||||||||||||
| 1188 | 4 | return q{}; | |||||||||||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | # Headings | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | # Common code for all headings. This is called before the actual heading is | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | # output. It returns the cleaned up heading text (putting the heading all on | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | # one line) and may do other things, like closing bad =item blocks. | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | 108 | ▶ | sub heading_common { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
heading_common: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 108 | my ($self, $text, $line) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1200 | 108 | $text =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 1201 | 108 | $text =~ s/\s*\n\s*/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | # This should never happen; it means that we have a heading after =item | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | # without an intervening =back. But just in case, handle it anyway. | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | 108 | ▶ | if ($$self{ITEMS} > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1206 | 0 | $$self{ITEMS} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | $self->output (".PD\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 108 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | # First level heading. We can't output .IX in the NAME section due to a bug | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | # in some versions of catman, so don't output a .IX for that section. .SH | ||||||||||||||||||||||||||||||||||||||||||
| 1215 | # already uses small caps, so remove \s0 and \s-1. Maintain IN_NAME as | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | # appropriate. | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | 95 | ▶ | sub cmd_head1 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_head1: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1218 | 95 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1219 | 95 | $text =~ s/\\s-?\d//g; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | 95 | $text = $self->heading_common ($text, $$attrs{start_line}); | |||||||||||||||||||||||||||||||||||||||||
| 1221 | 95 | ▶ | my $isname = ($text eq 'NAME' || $text =~ /\(NAME\)/); | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$text eq 'NAME' || $text =~ /\(NAME\)/u
MC/DC50%1/2
$text eq 'NAME' || $text =~ /\(NAME\)/u
$text eq 'NAME'
$text =~ /\(NAME\)/u
Truth table66%2/3
A || B
A= $text eq 'NAME'B= $text =~ /\(NAME\)/u
| |||||||||||||||||||||||||||||||||||||||||||
| 1222 | 95 | $self->output($self->switchquotes('.SH', $self->mapfonts($text, '\fP'))); | |||||||||||||||||||||||||||||||||||||||||
| 1223 | 95 | ▶ | $self->outindex ('Header', $text) unless $isname; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1224 | 95 | $$self{NEEDSPACE} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1225 | 95 | $$self{IN_NAME} = $isname; | |||||||||||||||||||||||||||||||||||||||||
| 1226 | 95 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | # Second level heading. | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | 5 | ▶ | sub cmd_head2 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_head2: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1231 | 5 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1232 | 5 | $text = $self->heading_common ($text, $$attrs{start_line}); | |||||||||||||||||||||||||||||||||||||||||
| 1233 | 5 | $self->output($self->switchquotes('.SS', $self->mapfonts($text, '\fP'))); | |||||||||||||||||||||||||||||||||||||||||
| 1234 | 5 | $self->outindex ('Subsection', $text); | |||||||||||||||||||||||||||||||||||||||||
| 1235 | 5 | $$self{NEEDSPACE} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1236 | 5 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | # Third level heading. *roff doesn't have this concept, so just put the | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | # heading in italics as a normal paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | 4 | ▶ | sub cmd_head3 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_head3: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1242 | 4 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1243 | 4 | $text = $self->heading_common ($text, $$attrs{start_line}); | |||||||||||||||||||||||||||||||||||||||||
| 1244 | 4 | $self->makespace; | |||||||||||||||||||||||||||||||||||||||||
| 1245 | 4 | $self->output($self->mapfonts('\f(IS' . $text . '\f(IE', '\fR') . "\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1246 | 4 | $self->outindex ('Subsection', $text); | |||||||||||||||||||||||||||||||||||||||||
| 1247 | 4 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 4 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | # Fourth level heading. *roff doesn't have this concept, so just put the | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | # heading as a normal paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | 4 | ▶ | sub cmd_head4 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_head4: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1254 | 4 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1255 | 4 | $text = $self->heading_common ($text, $$attrs{start_line}); | |||||||||||||||||||||||||||||||||||||||||
| 1256 | 4 | $self->makespace; | |||||||||||||||||||||||||||||||||||||||||
| 1257 | 4 | $self->output($self->mapfonts($text, '\fR') . "\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1258 | 4 | $self->outindex ('Subsection', $text); | |||||||||||||||||||||||||||||||||||||||||
| 1259 | 4 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1260 | 4 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | |||||||||||||||||||||||||||||||||||||||||||
| 1263 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | # Formatting codes | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | |||||||||||||||||||||||||||||||||||||||||||
| 1267 | # All of the formatting codes that aren't handled internally by the parser, | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | # other than L<> and X<>. | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | 21 | ▶ | sub cmd_b { return $_[0]->{IN_NAME} ? $_[2] : '\f(BS' . $_[2] . '\f(BE' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_b: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1270 | 42 | ▶ | sub cmd_i { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_i: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 7 | ▶ | sub cmd_f { return $_[0]->{IN_NAME} ? $_[2] : '\f(IS' . $_[2] . '\f(IE' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_f: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 118 | ▶ | sub cmd_c { return $_[0]->quote_literal ($_[2]) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_c: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | # Convert all internal whitespace to $NBSP. | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | 16 | ▶ | sub cmd_s { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_s: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1276 | 16 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1277 | 16 | $text =~ s{ \s }{$NBSP}xmsg; | |||||||||||||||||||||||||||||||||||||||||
| 1278 | 16 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||
| 1281 | # Index entries are just added to the pending entries. | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 5 | ▶ | sub cmd_x { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_x: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1283 | 5 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1284 | 5 | push (@{ $$self{INDEX} }, $text); | |||||||||||||||||||||||||||||||||||||||||
| 1285 | 5 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | # Pod::Man requires some special handling of links, so cannot treat it simply | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | # as a formatting directive all the time. | ||||||||||||||||||||||||||||||||||||||||||
| 1290 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | # For URL links, we want to show the URL itself in angle brackets, even | ||||||||||||||||||||||||||||||||||||||||||
| 1292 | # (optionally) if there is anchor text. We need to format the "to" value of | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | # the link before comparing it to the text since we may escape hyphens. | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | # For man page links, we want to ensure that the entire man page reference is | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | # formatted like one, even if we normally wouldn't detect it as such. This | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | # means we can't use the formatting that Pod::Simple does for us, and instead | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | # need to do all of the formatting ourselves. | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | 71 | ▶ | sub cmd_l { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_l: called CC=12 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1300 | 71 | my ($self, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1301 | 71 | ▶ | if ($$attrs{type} eq 'url') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1302 | 9 | my $to = $$attrs{to}; | |||||||||||||||||||||||||||||||||||||||||
| 1303 | 9 | ▶ | if (defined $to) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 9 | my $tag = $$self{PENDING}[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 1305 | 9 | $to = $self->format_text ($$tag[1], $to); | |||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | 9 | ▶ | if (not defined ($to) or $to eq $text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
not defined $to or $to eq $text
MC/DC50%1/2
not defined $to or $to eq $text
not defined $to
$to eq $text
Truth table66%2/3
not(A) or B
A= not defined $toB= $to eq $text
| |||||||||||||||||||||||||||||||||||||||||||
| 1308 | 1 | return "<$text>"; | |||||||||||||||||||||||||||||||||||||||||
| 1309 | } elsif ($self->{opt_nourls}) { | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | 1 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1311 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | 7 | return "$text <$$attrs{to}>"; | |||||||||||||||||||||||||||||||||||||||||
| 1313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | } elsif ($$attrs{type} eq 'man') { | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | 4 | ▶ | if (not $$attrs{'content-implicit'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | 3 | my $tag = $$self{PENDING}[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 1319 | 3 | my $to = $$attrs{to}; | |||||||||||||||||||||||||||||||||||||||||
| 1320 | 3 | my $section = $$attrs{section}; | |||||||||||||||||||||||||||||||||||||||||
| 1321 | 3 | ▶ | if ($section) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | $section = $self->format_text ($$tag[1], qq{"$section"}); | |||||||||||||||||||||||||||||||||||||||||
| 1323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | # If the man reference cannot be parsed, just fall back on whatever | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | # Pod::Simple wants to do. | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | 3 | my ($page, $mansection) = $to =~ m{ \A (.*) \( ([^\)]+) \) \z }xms; | |||||||||||||||||||||||||||||||||||||||||
| 1328 | 3 | ▶ | if (!defined($page) || !defined($mansection)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $page and defined $mansection
MC/DC0%0/2
defined $page and defined $mansection
defined $page
defined $mansection
Truth table33%1/3
A and B
A= defined $pageB= defined $mansection
| |||||||||||||||||||||||||||||||||||||||||||
| 1329 | 0 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | # Otherwise, do proper formatting, copying the normal output style of | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | # Pod::Simple. | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | 3 | $page = $self->format_text ($$tag[1], $page); | |||||||||||||||||||||||||||||||||||||||||
| 1335 | 3 | $mansection = $self->format_text ($$tag[1], $mansection); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 3 | $to = '\f(BS' . $page . '\f(BE\|' . "($mansection)"; | |||||||||||||||||||||||||||||||||||||||||
| 1337 | 3 | ▶ | if (defined($section)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1338 | 0 | return "$section in $to"; | |||||||||||||||||||||||||||||||||||||||||
| 1339 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | 3 | return $to; | |||||||||||||||||||||||||||||||||||||||||
| 1341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | 58 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||
| 1347 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | # List handling | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | # Handle the beginning of an =over block. Takes the type of the block as the | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | # first argument, and then the attr hash. This is called by the handlers for | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | # the four different types of lists (bullet, number, text, and block). | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | 45 | ▶ | sub over_common_start { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
over_common_start: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 45 | my ($self, $type, $attrs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1356 | 45 | my $line = $$attrs{start_line}; | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 45 | my $indent = $$attrs{indent}; | |||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | # Find the indentation level. | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | 45 | ▶ | unless (defined ($indent) && $indent =~ /^[-+]?\d{1,4}\s*$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $indent and $indent =~ /^[-+]?\d{1,4}\s*$/u
MC/DC0%0/2
defined $indent and $indent =~ /^[-+]?\d{1,4}\s*$/u
defined $indent
$indent =~ /^[-+]?\d{1,4}\s*$/u
Truth table33%1/3
A and B
A= defined $indentB= $indent =~ /^[-+]?\d{1,4}\s*$/u
| |||||||||||||||||||||||||||||||||||||||||||
| 1361 | 0 | $indent = $self->{opt_indent}; | |||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | # If we've gotten multiple indentations in a row, we need to emit the | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | # pending indentation for the last level that we saw and haven't acted on | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | # yet. SHIFTS is the stack of indentations that we've actually emitted | ||||||||||||||||||||||||||||||||||||||||||
| 1367 | # code for. | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | 45 | ▶ | if (@{ $$self{SHIFTS} } < @{ $$self{INDENTS} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1369 | 8 | $self->output (".RS $$self{INDENT}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1370 | 8 | push (@{ $$self{SHIFTS} }, $$self{INDENT}); | |||||||||||||||||||||||||||||||||||||||||
| 1371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | # Now, do record-keeping. INDENTS is a stack of indentations that we've | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | # seen so far, and INDENT is the current level of indentation. ITEMTYPES | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | # is a stack of list types that we've seen. | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | 45 | push (@{ $$self{INDENTS} }, $$self{INDENT}); | |||||||||||||||||||||||||||||||||||||||||
| 1377 | 45 | push (@{ $$self{ITEMTYPES} }, $type); | |||||||||||||||||||||||||||||||||||||||||
| 1378 | 45 | $$self{INDENT} = $indent + 0; | |||||||||||||||||||||||||||||||||||||||||
| 1379 | 45 | $$self{SHIFTWAIT} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||
| 1382 | # End an =over block. Takes no options other than the class pointer. | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | # Normally, once we close a block and therefore remove something from INDENTS, | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | # INDENTS will now be longer than SHIFTS, indicating that we also need to emit | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | # *roff code to close the indent. This isn't *always* true, depending on the | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | # circumstance. If we're still inside an indentation, we need to emit another | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | # .RE and then a new .RS to unconfuse *roff. | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | 45 | ▶ | sub over_common_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
over_common_end: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1389 | 45 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1390 | 45 | $$self{INDENT} = pop @{ $$self{INDENTS} }; | |||||||||||||||||||||||||||||||||||||||||
| 1391 | 45 | pop @{ $$self{ITEMTYPES} }; | |||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | # If there were multiple =item tags in a row, none of which have bodies, | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | # we have disabled spacing with .PD 0 but have not set NEEDSPACE, so | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | # makespace will not turn spacing back on with .PD. We have to do that | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | # ourselves, and also reset the count of consecutive items since we've now | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | # left the block in which we were counting. | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | 45 | ▶ | $self->output (".PD\n") if $$self{ITEMS} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 45 | $$self{ITEMS} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||
| 1401 | # If we emitted code for that indentation, end it. | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | 45 | ▶ | if (@{ $$self{SHIFTS} } > @{ $$self{INDENTS} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1403 | 9 | $self->output (".RE\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1404 | 9 | pop @{ $$self{SHIFTS} }; | |||||||||||||||||||||||||||||||||||||||||
| 1405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||
| 1407 | # If we're still in an indentation, *roff will have now lost track of the | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | # right depth of that indentation, so fix that. | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | 45 | ▶ | if (@{ $$self{INDENTS} } > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1410 | 10 | $self->output (".RE\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1411 | 10 | $self->output (".RS $$self{INDENT}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | 45 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1414 | 45 | $$self{SHIFTWAIT} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||
| 1417 | # Dispatch the start and end calls as appropriate. | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | #<<< | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | 6 | ▶ | sub start_over_bullet { my $s = shift; $s->over_common_start('bullet', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_over_bullet: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1420 | 5 | ▶ | sub start_over_number { my $s = shift; $s->over_common_start('number', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_over_number: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1421 | 28 | ▶ | sub start_over_text { my $s = shift; $s->over_common_start('text', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_over_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1422 | 6 | ▶ | sub start_over_block { my $s = shift; $s->over_common_start('block', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_over_block: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1423 | 6 | ▶ | sub end_over_bullet { my ($self) = @_; $self->over_common_end() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_over_bullet: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1424 | 5 | ▶ | sub end_over_number { my ($self) = @_; $self->over_common_end() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_over_number: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1425 | 28 | ▶ | sub end_over_text { my ($self) = @_; $self->over_common_end() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_over_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1426 | 6 | ▶ | sub end_over_block { my ($self) = @_; $self->over_common_end() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_over_block: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1427 | #>>> | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | # The common handler for all item commands. Takes the type of the item, the | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | # attributes, and then the text of the item. | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | # Emit an index entry for anything that's interesting, but don't emit index | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | # entries for things like bullets and numbers. Newlines in an item title are | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | # turned into spaces since *roff can't handle them embedded. | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | 79 | ▶ | sub item_common { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item_common: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1436 | 79 | my ($self, $type, $attrs, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1437 | 79 | my $line = $$attrs{start_line}; | |||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | # Clean up the text. We want to end up with two variables, one ($text) | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | # which contains any body text after taking out the item portion, and | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | # another ($item) which contains the actual item text. | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | 79 | $text =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 1443 | 79 | my ($item, $index); | |||||||||||||||||||||||||||||||||||||||||
| 1444 | 79 | ▶ | if ($type eq 'bullet') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1445 | 12 | $item = "\\\(bu"; | |||||||||||||||||||||||||||||||||||||||||
| 1446 | 12 | $text =~ s/\n*$/\n/; | |||||||||||||||||||||||||||||||||||||||||
| 1447 | } elsif ($type eq 'number') { | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | 10 | $item = $$attrs{number} . '.'; | |||||||||||||||||||||||||||||||||||||||||
| 1449 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | 57 | $item = $text; | |||||||||||||||||||||||||||||||||||||||||
| 1451 | 57 | $item =~ s/\s*\n\s*/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 1452 | 57 | $text = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1453 | 57 | ▶ | $index = $item if ($item =~ /\w/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | # Take care of the indentation. If shifts and indents are equal, close | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | # the top shift, since we're about to create an indentation with .IP. | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | 79 | ▶ | if (@{ $$self{SHIFTS} } == @{ $$self{INDENTS} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 3 | $self->output (".RE\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1460 | 3 | pop @{ $$self{SHIFTS} }; | |||||||||||||||||||||||||||||||||||||||||
| 1461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||
| 1463 | # Output .PD 0 to turn off spacing between items if this item is directly | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | # following another one. We only have to do that once for a whole chain | ||||||||||||||||||||||||||||||||||||||||||
| 1465 | # of items so do it for the second item in the change. This is undone by | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | # makespace. | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | 79 | ▶ | $self->output (".PD 0\n") if ($$self{ITEMS} == 1); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||
| 1469 | # Now, output the item tag itself. | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | 79 | $item = $self->mapfonts($item, '\fR'); | |||||||||||||||||||||||||||||||||||||||||
| 1471 | 79 | ▶ | if ($type eq 'bullet' || $type eq 'number') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$type eq "bullet" or $type eq "number"
MC/DC100%2/2
$type eq "bullet" or $type eq "number"
$type eq "bullet"
$type eq "number"
Truth table100%3/3
A or B
A= $type eq "bullet"B= $type eq "number"
| |||||||||||||||||||||||||||||||||||||||||||
| 1472 | 22 | $self->output($self->switchquotes('.IP', $item, $$self{INDENT})); | |||||||||||||||||||||||||||||||||||||||||
| 1473 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | 57 | $self->output(".TP $$self{INDENT}\n"); | |||||||||||||||||||||||||||||||||||||||||
| 1475 | 57 | $self->output($self->protect("$item\n")); | |||||||||||||||||||||||||||||||||||||||||
| 1476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | 79 | $$self{NEEDSPACE} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1478 | 79 | $$self{ITEMS}++; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | 79 | $$self{SHIFTWAIT} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | # If body text for this item was included, go ahead and output that now. | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | 79 | ▶ | if ($text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1483 | 20 | $text =~ s/\s*$/\n/; | |||||||||||||||||||||||||||||||||||||||||
| 1484 | 20 | $self->makespace; | |||||||||||||||||||||||||||||||||||||||||
| 1485 | 20 | $self->output($self->protect($self->mapfonts($text, '\fR'))); | |||||||||||||||||||||||||||||||||||||||||
| 1486 | 20 | $$self{NEEDSPACE} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1488 | 79 | ▶ | $self->outindex ($index ? ('Item', $index) : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | # Dispatch the item commands to the appropriate place. | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | #<<< | ||||||||||||||||||||||||||||||||||||||||||
| 1493 | 12 | ▶ | sub cmd_item_bullet { my $self = shift; $self->item_common('bullet', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_item_bullet: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1494 | 10 | ▶ | sub cmd_item_number { my $self = shift; $self->item_common('number', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_item_number: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1495 | 57 | ▶ | sub cmd_item_text { my $self = shift; $self->item_common('text', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_item_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1496 | 0 | ▶ | sub cmd_item_block { my $self = shift; $self->item_common('block', @_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmd_item_block: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1497 | #>>> | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | # Backward compatibility | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | # Reset the underlying Pod::Simple object between calls to parse_from_file so | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | # that the same object can be reused to convert multiple pages. | ||||||||||||||||||||||||||||||||||||||||||
| 1505 | 9 | ▶ | sub parse_from_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_from_file: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1506 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1507 | 9 | $self->reinit; | |||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||
| 1509 | # Fake the old cutting option to Pod::Parser. This fiddles with internal | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | # Pod::Simple state and is quite ugly; we need a better approach. | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | 9 | ▶ | if (ref ($_[0]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1512 | 1 | my $opts = shift @_; | |||||||||||||||||||||||||||||||||||||||||
| 1513 | 1 | ▶ | if (defined ($$opts{-cutting}) && !$$opts{-cutting}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $opts->{"-cutting"} and not $opts->{"-cutting"}
MC/DC0%0/2
defined $opts->{"-cutting"} and not $opts->{"-cutting"}
defined $opts->{"-cutting"}
not $opts->{"-cutting"}
Truth table33%1/3
A and not(B)
A= defined $opts->{"-cutting"}B= not $opts->{"-cutting"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1514 | 1 | $$self{in_pod} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1515 | 1 | $$self{last_was_blank} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||
| 1519 | # Do the work. | ||||||||||||||||||||||||||||||||||||||||||
| 1520 | 9 | my $retval = $self->SUPER::parse_from_file (@_); | |||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||
| 1522 | # Flush output, since Pod::Simple doesn't do this. Ideally we should also | ||||||||||||||||||||||||||||||||||||||||||
| 1523 | # close the file descriptor if we had to open one, but we can't easily | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | # figure this out. | ||||||||||||||||||||||||||||||||||||||||||
| 1525 | 9 | my $fh = $self->output_fh (); | |||||||||||||||||||||||||||||||||||||||||
| 1526 | 9 | my $oldfh = select $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1527 | 9 | my $oldflush = $|; | |||||||||||||||||||||||||||||||||||||||||
| 1528 | 9 | $| = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1529 | 9 | print $fh ''; | |||||||||||||||||||||||||||||||||||||||||
| 1530 | 9 | $| = $oldflush; | |||||||||||||||||||||||||||||||||||||||||
| 1531 | 9 | select $oldfh; | |||||||||||||||||||||||||||||||||||||||||
| 1532 | 9 | return $retval; | |||||||||||||||||||||||||||||||||||||||||
| 1533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||
| 1535 | # Pod::Simple failed to provide this backward compatibility function, so | ||||||||||||||||||||||||||||||||||||||||||
| 1536 | # implement it ourselves. File handles are one of the inputs that | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | # parse_from_file supports. | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | 1 | ▶ | sub parse_from_filehandle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_from_filehandle: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1539 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1540 | 1 | return $self->parse_from_file (@_); | |||||||||||||||||||||||||||||||||||||||||
| 1541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | # Pod::Simple's parse_file doesn't set output_fh. Wrap the call and do so | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | # ourself unless it was already set by the caller, since our documentation has | ||||||||||||||||||||||||||||||||||||||||||
| 1545 | # always said that this should work. | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | 14 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1547 | 14 | my ($self, $in) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1548 | 14 | ▶ | unless (defined $$self{output_fh}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | $self->output_fh (\*STDOUT); | |||||||||||||||||||||||||||||||||||||||||
| 1550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | 14 | return $self->SUPER::parse_file ($in); | |||||||||||||||||||||||||||||||||||||||||
| 1552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | # Do the same for parse_lines, just to be polite. Pod::Simple's man page | ||||||||||||||||||||||||||||||||||||||||||
| 1555 | # implies that the caller is responsible for setting this, but I don't see any | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | # reason not to set a default. | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | 585 | ▶ | sub parse_lines { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_lines: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1558 | 585 | my ($self, @lines) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1559 | 585 | ▶ | unless (defined $$self{output_fh}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | $self->output_fh (\*STDOUT); | |||||||||||||||||||||||||||||||||||||||||
| 1561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | 585 | return $self->SUPER::parse_lines (@lines); | |||||||||||||||||||||||||||||||||||||||||
| 1563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||||||||||||||||
| 1565 | # Likewise for parse_string_document. | ||||||||||||||||||||||||||||||||||||||||||
| 1566 | 68 | ▶ | sub parse_string_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_string_document: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1567 | 68 | my ($self, $doc) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1568 | 68 | ▶ | unless (defined $$self{output_fh}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | $self->output_fh (\*STDOUT); | |||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | 68 | return $self->SUPER::parse_string_document ($doc); | |||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||
| 1574 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | # Premable | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||||||||||||||||
| 1578 | # The preamble which starts all *roff output we generate. Most is static | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | # except for the font to use as a fixed-width font (designed by @CFONT@), and | ||||||||||||||||||||||||||||||||||||||||||
| 1580 | # the left and right quotes to use for C<> text (designated by @LQOUTE@ and | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | # @RQUOTE@). Accent marks are only defined if the output encoding is roff. | ||||||||||||||||||||||||||||||||||||||||||
| 1582 | 80 | ▶ | sub preamble_template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
preamble_template: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1583 | 80 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1584 | 80 | my $preamble = <<'----END OF PREAMBLE----'; | |||||||||||||||||||||||||||||||||||||||||
| 1585 | .de Sp \" Vertical space (when we can't use .PP) | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | .if t .sp .5v | ||||||||||||||||||||||||||||||||||||||||||
| 1587 | .if n .sp | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | .. | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | .de Vb \" Begin verbatim text | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | .ft @CFONT@ | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | .nf | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | .ne \\$1 | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | .. | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | .de Ve \" End verbatim text | ||||||||||||||||||||||||||||||||||||||||||
| 1595 | .ft R | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | .fi | ||||||||||||||||||||||||||||||||||||||||||
| 1597 | .. | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | .ie n \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | . ds C` @LQUOTE@ | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | . ds C' @RQUOTE@ | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | 'br\} | ||||||||||||||||||||||||||||||||||||||||||
| 1603 | .el\{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | . ds C` | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | . ds C' | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | 'br\} | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | .\" | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | .\" Escape single quotes in literal strings from groff's Unicode transform. | ||||||||||||||||||||||||||||||||||||||||||
| 1609 | .ie \n(.g .ds Aq \(aq | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | .el .ds Aq ' | ||||||||||||||||||||||||||||||||||||||||||
| 1611 | .\" | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | .\" If the F register is >0, we'll generate index entries on stderr for | ||||||||||||||||||||||||||||||||||||||||||
| 1613 | .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | .\" entries marked with X<> in POD. Of course, you'll have to process the | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | .\" output yourself in some meaningful fashion. | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | .\" | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | .\" Avoid warning from groff about undefined register 'F'. | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | .de IX | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | .. | ||||||||||||||||||||||||||||||||||||||||||
| 1620 | .nr rF 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1621 | .if \n(.g .if rF .nr rF 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | .if (\n(rF:(\n(.g==0)) \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1623 | . if \nF \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1624 | . de IX | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | . tm Index:\\$1\t\\n%\t"\\$2" | ||||||||||||||||||||||||||||||||||||||||||
| 1626 | .. | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | . if !\nF==2 \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1628 | . nr % 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | . nr F 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | . \} | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | . \} | ||||||||||||||||||||||||||||||||||||||||||
| 1632 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | .rr rF | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | ----END OF PREAMBLE---- | ||||||||||||||||||||||||||||||||||||||||||
| 1635 | |||||||||||||||||||||||||||||||||||||||||||
| 1636 | 80 | ▶ | if ($$self{ENCODING} eq 'roff') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1637 | 6 | $preamble .= <<'----END OF PREAMBLE----' | |||||||||||||||||||||||||||||||||||||||||
| 1638 | .\" | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | .\" Fear. Run. Save yourself. No user-serviceable parts. | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | . \" fudge factors for nroff and troff | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | .if n \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | . ds #H 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | . ds #V .8m | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | . ds #F .3m | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | . ds #[ \f1 | ||||||||||||||||||||||||||||||||||||||||||
| 1647 | . ds #] \fP | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1649 | .if t \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | ||||||||||||||||||||||||||||||||||||||||||
| 1651 | . ds #V .6m | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | . ds #F 0 | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | . ds #[ \& | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | . ds #] \& | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | . \" simple accents for nroff and troff | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | .if n \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1658 | . ds ' \& | ||||||||||||||||||||||||||||||||||||||||||
| 1659 | . ds ` \& | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | . ds ^ \& | ||||||||||||||||||||||||||||||||||||||||||
| 1661 | . ds , \& | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | . ds ~ ~ | ||||||||||||||||||||||||||||||||||||||||||
| 1663 | . ds / | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1665 | .if t \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1667 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1669 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1671 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1673 | . \" troff and (daisy-wheel) nroff accents | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | ||||||||||||||||||||||||||||||||||||||||||
| 1675 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | ||||||||||||||||||||||||||||||||||||||||||
| 1677 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1679 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | ||||||||||||||||||||||||||||||||||||||||||
| 1681 | .ds ae a\h'-(\w'a'u*4/10)'e | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | .ds Ae A\h'-(\w'A'u*4/10)'E | ||||||||||||||||||||||||||||||||||||||||||
| 1683 | . \" corrections for vroff | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1685 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | . \" for low resolution devices (crt and lpr) | ||||||||||||||||||||||||||||||||||||||||||
| 1687 | .if \n(.H>23 .if \n(.V>19 \ | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | \{\ | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | . ds : e | ||||||||||||||||||||||||||||||||||||||||||
| 1690 | . ds 8 ss | ||||||||||||||||||||||||||||||||||||||||||
| 1691 | . ds o a | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | . ds d- d\h'-1'\(ga | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | . ds D- D\h'-1'\(hy | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | . ds th \o'bp' | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | . ds Th \o'LP' | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | . ds ae ae | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | . ds Ae AE | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | .\} | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | .rm #[ #] #H #V #F C | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | ----END OF PREAMBLE---- | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | #`# for cperl-mode | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1703 | 80 | return $preamble; | |||||||||||||||||||||||||||||||||||||||||
| 1704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | |||||||||||||||||||||||||||||||||||||||||||
| 1706 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | # Module return value and documentation | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||
| 1710 | 12 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1711 | __END__ | ||||||||||||||||||||||||||||||||||||||||||