| 1 | package Pod::Simple::HTML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use Pod::Simple::PullParser (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | our @ISA = ('Pod::Simple::PullParser'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | our $VERSION = '3.48'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | if(defined &DEBUG) { } # no-op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | else { *DEBUG = sub () {0}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | our $Doctype_decl ||= ''; # No. Just No. Don't even ask me for it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
our $Doctype_decl ||= ""
MC/DC0%0/1
our $Doctype_decl ||= ""
our $Doctype_decl
Truth table50%1/2
A
A= our $Doctype_decl
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # qq{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # "http://www.w3.org/TR/html4/loose.dtd">\n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | our $Content_decl ||= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
our $Content_decl ||= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" >"
MC/DC0%0/1
our $Content_decl ||= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" >"
our $Content_decl
Truth table50%1/2
A
A= our $Content_decl
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | q{<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 7 | our $HTML_EXTENSION; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | ▶ | $HTML_EXTENSION = '.html' unless defined $HTML_EXTENSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 7 | our $Computerese; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | $Computerese = "" unless defined $Computerese; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 7 | our $LamePad; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | $LamePad = '' unless defined $LamePad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 7 | our $Linearization_Limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 7 | ▶ | $Linearization_Limit = 120 unless defined $Linearization_Limit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # headings/items longer than that won't get an <a name="..."> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 7 | our $Perldoc_URL_Prefix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 7 | ▶ | $Perldoc_URL_Prefix = 'https://metacpan.org/pod/' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | unless defined $Perldoc_URL_Prefix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 7 | our $Perldoc_URL_Postfix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 7 | ▶ | $Perldoc_URL_Postfix = '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | unless defined $Perldoc_URL_Postfix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | our $Man_URL_Prefix = 'https://man7.org/linux/man-pages/man'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | our $Man_URL_Postfix = '.html'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 7 | our $Title_Prefix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | ▶ | $Title_Prefix = '' unless defined $Title_Prefix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 7 | our $Title_Postfix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 7 | ▶ | $Title_Postfix = '' unless defined $Title_Postfix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 7 | our %ToIndex = map {; $_ => 1 } qw(head1 head2 head3 head4 ); # item-text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # 'item-text' stuff in the index doesn't quite work, and may | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # not be a good idea anyhow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | __PACKAGE__->_accessorize( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 'perldoc_url_prefix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # In turning L<Foo::Bar> into http://whatever/Foo%3a%3aBar, what | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # to put before the "Foo%3a%3aBar". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # (for singleton mode only?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 'perldoc_url_postfix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # what to put after "Foo%3a%3aBar" in the URL. Normally "". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 'man_url_prefix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # In turning L<crontab(5)> into http://whatever/man/1/crontab, what | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # to put before the "1/crontab". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 'man_url_postfix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # what to put after the "1/crontab" in the URL. Normally ".html". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 'batch_mode', # whether we're in batch mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 'batch_mode_current_level', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # When in batch mode, how deep the current module is: 1 for "LWP", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # 2 for "LWP::Procotol", 3 for "LWP::Protocol::GHTTP", etc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 'title_prefix', 'title_postfix', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # What to put before and after the title in the head. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # Should already be &-escaped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 'html_h_level', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 'html_header_before_title', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 'html_header_after_title', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'html_footer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 'top_anchor', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 'index', # whether to add an index at the top of each page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # (actually it's a table-of-contents, but we'll call it an index, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # out of apparently longstanding habit) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 'html_css', # URL of CSS file to point to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 'html_javascript', # URL of Javascript file to point to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 'force_title', # should already be &-escaped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 'default_title', # should already be &-escaped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 7 | my @_to_accept; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | our %Tagmap = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 'Verbatim' => "\n<pre$Computerese>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | '/Verbatim' => "</pre>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 'VerbatimFormatted' => "\n<pre$Computerese>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | '/VerbatimFormatted' => "</pre>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 'VerbatimB' => "<b>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | '/VerbatimB' => "</b>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 'VerbatimI' => "<i>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | '/VerbatimI' => "</i>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 'VerbatimBI' => "<b><i>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | '/VerbatimBI' => "</i></b>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'Data' => "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | '/Data' => "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 'head1' => "\n<h1>", # And also stick in an <a name="..."> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 'head2' => "\n<h2>", # '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 'head3' => "\n<h3>", # '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 'head4' => "\n<h4>", # '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'head5' => "\n<h5>", # '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'head6' => "\n<h6>", # '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | '/head1' => "</a></h1>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | '/head2' => "</a></h2>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | '/head3' => "</a></h3>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | '/head4' => "</a></h4>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | '/head5' => "</a></h5>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | '/head6' => "</a></h6>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 'X' => "<!--\n\tINDEX: ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | '/X' => "\n-->", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | changes(qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | Para=p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | B=b I=i U=u | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | over-bullet=ul | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | over-number=ol | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | over-text=dl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | over-block=blockquote | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | item-bullet=li | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | item-number=li | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | item-text=dt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | )), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | changes2( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 7 | ▶ | map {; m/^([-a-z]+)/s && push @_to_accept, $1; $_ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | qw[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | sample=samp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | definition=dfn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | keyboard=kbd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | variable=var | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | citation=cite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | abbreviation=abbr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | acronym=acronym | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | subscript=sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | superscript=sup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | big=big | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | small=small | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | underline=u | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | strikethrough=s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | preformat=pre | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | teletype=tt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | ] # no point in providing a way to get <q>...</q>, I think | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | '/item-bullet' => "</li>$LamePad\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | '/item-number' => "</li>$LamePad\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | '/item-text' => "</a></dt>$LamePad\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 'item-body' => "\n<dd>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | '/item-body' => "</dd>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 'B' => "<b>", '/B' => "</b>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 'I' => "<i>", '/I' => "</i>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 'U' => "<u>", '/U' => "</u>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 'F' => "<em$Computerese>", '/F' => "</em>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 'C' => "<code$Computerese>", '/C' => "</code>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 'L' => "<a href='YOU_SHOULD_NEVER_SEE_THIS'>", # ideally never used! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | '/L' => "</a>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 7 | ▶ | sub changes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changes: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | ▶ | return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ? ( $1, => "\n<$2>", "/$1", => "</$2>\n" ) : die "Funky $_" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 7 | ▶ | sub changes2 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
changes2: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 7 | ▶ | return map {; m/^([-_:0-9a-zA-Z]+)=([-_:0-9a-zA-Z]+)$/s | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ? ( $1, => "<$2>", "/$1", => "</$2>" ) : die "Funky $_" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub go { Pod::Simple::HTML->parse_from_file(@ARGV); exit 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # Just so we can run from the command line. No options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # For that, use perldoc! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 60 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 60 | my $new = shift->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | #$new->nix_X_codes(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 60 | $new->nbsp_for_S(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 60 | $new->accept_targets( 'html', 'HTML' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 60 | $new->accept_codes('VerbatimFormatted'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 60 | $new->accept_codes(@_to_accept); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 60 | DEBUG > 2 and print STDERR "To accept: ", join(' ',@_to_accept), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 60 | $new->perldoc_url_prefix( $Perldoc_URL_Prefix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 60 | $new->perldoc_url_postfix( $Perldoc_URL_Postfix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 60 | $new->man_url_prefix( $Man_URL_Prefix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 60 | $new->man_url_postfix( $Man_URL_Postfix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 60 | $new->title_prefix( $Title_Prefix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 60 | $new->title_postfix( $Title_Postfix ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 60 | $new->html_header_before_title( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | qq[$Doctype_decl<html><head><title>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 60 | $new->html_header_after_title( join "\n" => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | "</title>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $Content_decl, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | "</head>\n<body class='pod'>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $new->version_tag_comment, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | "<!-- start doc -->\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 60 | $new->html_footer( qq[\n<!-- end doc -->\n\n</body></html>\n] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 60 | $new->top_anchor( "<a name='___top' class='dummyTopAnchor' ></a>\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 60 | $new->{'Tagmap'} = {%Tagmap}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 60 | return $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 59 | ▶ | sub __adjust_html_h_levels { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__adjust_html_h_levels: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 59 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 59 | my $Tagmap = $self->{'Tagmap'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 59 | my $add = $self->html_h_level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 59 | ▶ | return unless defined $add; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | ▶ | return if ($self->{'Adjusted_html_h_levels'}||0) == $add; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{'Adjusted_html_h_levels'} || 0
MC/DC0%0/1
$self->{'Adjusted_html_h_levels'} || 0
$self->{'Adjusted_html_h_levels'}
Truth table50%1/2
A
A= $self->{'Adjusted_html_h_levels'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | $add -= 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | for (1 .. 6) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 6 | $Tagmap->{"head$_"} =~ s/$_/$_ + $add/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | $Tagmap->{"/head$_"} =~ s/$_/$_ + $add/e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 10 | ▶ | sub batch_mode_page_object_init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
batch_mode_page_object_init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 10 | my($self, $batchconvobj, $module, $infile, $outfile, $depth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 10 | DEBUG and print STDERR "Initting $self\n for $module\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | " in $infile\n out $outfile\n depth $depth\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 10 | $self->batch_mode(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 10 | $self->batch_mode_current_level($depth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 60 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 60 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 60 | ▶ | return $self->do_middle if $self->bare_output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 18 | ▶ | $self->do_beginning && $self->do_middle && $self->do_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$self->do_beginning && $self->do_middle && $self->do_end
$self->do_beginning and $self->do_middle
MC/DC33%1/3
$self->do_beginning && $self->do_middle && $self->do_end
$self->do_beginning
$self->do_middle
$self->do_end
Truth table50%2/4
A and B && C
A= $self->do_beginningB= $self->do_middleC= $self->do_end
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 18 | ▶ | sub do_beginning { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_beginning: called CC=12 SCAR=25.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 18 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 18 | my $title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 18 | ▶ | if(defined $self->force_title) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $title = $self->force_title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | DEBUG and print STDERR "Forcing title to be $title\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # Actually try looking for the title in the document: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 18 | $title = $self->get_short_title(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 18 | ▶ | unless($self->content_seen) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | DEBUG and print STDERR "No content seen in search for title.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 17 | $self->{'Title'} = $title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 17 | ▶ | if(defined $title and $title =~ m/\S/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $title and $title =~ /\S/
MC/DC50%1/2
defined $title and $title =~ /\S/
defined $title
$title =~ /\S/
Truth table66%2/3
A and B
A= defined $titleB= $title =~ /\S/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 14 | $title = $self->title_prefix . esc($title) . $self->title_postfix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 3 | $title = $self->default_title; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 3 | ▶ | $title = '' unless defined $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | DEBUG and print STDERR "Title defaults to $title\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 17 | ▶ | my $after = $self->html_header_after_title || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->html_header_after_title || ''
MC/DC0%0/1
$self->html_header_after_title || ''
$self->html_header_after_title
Truth table50%1/2
A
A= $self->html_header_after_title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 17 | ▶ | if($self->html_css) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 10 | ▶ | my $link = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $self->html_css =~ m/</ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ? $self->html_css # It's a big blob of markup, let's drop it in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | : sprintf( # It's just a URL, so let's wrap it up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | qq[<link rel="stylesheet" type="text/css" title="pod_stylesheet" href="%s">\n], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | $self->html_css, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 10 | $after =~ s{(</head>)}{$link\n$1}i; # otherwise nevermind | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 17 | $self->_add_top_anchor(\$after); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 17 | ▶ | if($self->html_javascript) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 10 | ▶ | my $link = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $self->html_javascript =~ m/</ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ? $self->html_javascript # It's a big blob of markup, let's drop it in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | : sprintf( # It's just a URL, so let's wrap it up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | qq[<script type="text/javascript" src="%s"></script>\n], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | $self->html_javascript, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 10 | $after =~ s{(</head>)}{$link\n$1}i; # otherwise nevermind | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 17 | ▶ | print {$self->{'output_fh'}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->html_header_before_title || ''
MC/DC0%0/1
$self->html_header_before_title || ''
$self->html_header_before_title
Truth table50%1/2
A
A= $self->html_header_before_title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | $self->html_header_before_title || '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | $title, # already escaped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | $after, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 17 | DEBUG and print STDERR "Returning from do_beginning...\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 17 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 17 | ▶ | sub _add_top_anchor { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_top_anchor: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 17 | my($self, $text_r) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 17 | ▶ | unless($$text_r and $$text_r =~ m/name=['"]___top['"]/) { # a hack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$$text_r and $$text_r =~ /name=['"]___top['"]/
MC/DC50%1/2
$$text_r and $$text_r =~ /name=['"]___top['"]/
$$text_r
$$text_r =~ /name=['"]___top['"]/
Truth table66%2/3
A and B
A= $$text_rB= $$text_r =~ /name=['"]___top['"]/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 7 | ▶ | $$text_r .= $self->top_anchor || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->top_anchor || ''
MC/DC0%0/1
$self->top_anchor || ''
$self->top_anchor
Truth table50%1/2
A
A= $self->top_anchor
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 17 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 60 | ▶ | sub version_tag_comment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version_tag_comment: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 60 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | return sprintf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | "<!--\n generated by %s v%s,\n using %s v%s,\n under Perl v%s at %s GMT.\n\n %s\n\n-->\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | esc( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | ref($self), $self->VERSION(), $ISA[0], $ISA[0]->VERSION(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 60 | ▶ | $], scalar(gmtime($ENV{SOURCE_DATE_EPOCH} || time)), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'SOURCE_DATE_EPOCH'} || time
MC/DC0%0/1
$ENV{'SOURCE_DATE_EPOCH'} || time
$ENV{'SOURCE_DATE_EPOCH'}
Truth table50%1/2
A
A= $ENV{'SOURCE_DATE_EPOCH'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ), $self->_modnote(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 60 | ▶ | sub _modnote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_modnote: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 60 | ▶ | my $class = ref($_[0]) || $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 60 | return join "\n " => grep m/\S/, split "\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | qq{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | If you want to change this HTML document, you probably shouldn't do that | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | by changing it directly. Instead, see about changing the calling options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | to $class, and/or subclassing $class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | then reconverting this document from the Pod source. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | When in doubt, email the author of $class for advice. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | See 'perldoc $class' for more info. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 17 | ▶ | sub do_end { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_end: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 17 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 17 | ▶ | print {$self->{'output_fh'}} $self->html_footer || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->html_footer || ''
MC/DC0%0/1
$self->html_footer || ''
$self->html_footer
Truth table50%1/2
A
A= $self->html_footer
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 17 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # Normally this would just be a call to _do_middle_main_loop -- but we | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # have to do some elaborate things to emit all the content and then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # summarize it and output it /before/ the content that it's a summary of. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 59 | ▶ | sub do_middle { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_middle: called CC=5 SCAR=20.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 59 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 59 | ▶ | return $self->_do_middle_main_loop unless $self->index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 10 | ▶ | if( $self->output_string ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # An efficiency hack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my $out = $self->output_string; #it's a reference to it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my $sneakytag = "\f\f\e\e\b\bIndex Here\e\e\b\b\f\f\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $$out .= $sneakytag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $self->_do_middle_main_loop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $sneakytag = quotemeta($sneakytag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $index = $self->index_as_html(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if( $$out =~ s/$sneakytag/$index/s ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # Expected case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | DEBUG and print STDERR "Inserted ", length($index), " bytes of index HTML into $out.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | DEBUG and print STDERR "Odd, couldn't find where to insert the index in the output!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # I don't think this should ever happen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 10 | ▶ | unless( $self->output_fh ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | Carp::confess("Parser object \$p doesn't seem to have any output object! I don't know how to deal with that."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | # If we get here, we're outputting to a FH. So we need to do some magic. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # Namely, divert all content to a string, which we output after the index. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 10 | my $fh = $self->output_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 10 | my $content = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # Our horrible bait and switch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 10 | $self->output_string( \$content ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 10 | $self->_do_middle_main_loop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 10 | $self->abandon_output_string(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 10 | $self->output_fh($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 10 | print $fh $self->index_as_html(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 10 | print $fh $content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 10 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | ########################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 10 | ▶ | sub index_as_html { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index_as_html: called CC=9 SCAR=22.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 10 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # This is meant to be called AFTER the input document has been parsed! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 10 | ▶ | my $points = $self->{'PSHTML_index_points'} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'PSHTML_index_points'} || []
MC/DC0%0/1
$self->{'PSHTML_index_points'} || []
$self->{'PSHTML_index_points'}
Truth table50%1/2
A
A= $self->{'PSHTML_index_points'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 10 | ▶ | @$points > 1 or return qq[<div class='indexgroupEmpty'></div>\n]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | # There's no point in having a 0-item or 1-item index, I dare say. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | my(@out) = qq{\n<div class='indexgroup'>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 8 | my $level = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 8 | my( $target_level, $previous_tagname, $tagname, $text, $anchorname, $indent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 8 | foreach my $p (@$points, ['head0', '(end)']) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 26 | ($tagname, $text) = @$p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 26 | $anchorname = $self->section_escape($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 26 | ▶ | if( $tagname =~ m{^head(\d+)$} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 26 | $target_level = 0 + $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } else { # must be some kinda list item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | if($previous_tagname =~ m{^head\d+$} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | $target_level = $level + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $target_level = $level; # no change needed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # Get to target_level by opening or closing ULs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 26 | ▶ | while($level > $target_level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 9 | { --$level; push @out, (" " x $level) . "</ul>"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 26 | ▶ | while($level < $target_level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 9 | { ++$level; push @out, (" " x ($level-1)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | . "<ul class='indexList indexList$level'>"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 26 | $previous_tagname = $tagname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 26 | ▶ | next unless $level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 18 | $indent = ' ' x $level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 18 | push @out, sprintf | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | "%s<li class='indexItem indexItem%s'><a href='#%s'>%s</a>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | $indent, $level, esc($anchorname), esc($text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 8 | push @out, "</div>\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 8 | return join "\n", @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | ########################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 59 | ▶ | sub _do_middle_main_loop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_middle_main_loop: called CC=41 SCAR=39.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 59 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 59 | my $fh = $self->{'output_fh'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 59 | my $tagmap = $self->{'Tagmap'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 59 | $self->__adjust_html_h_levels; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 59 | my($token, $type, $tagname, $linkto, $linktype); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 59 | my @stack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 59 | my $dont_wrap = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 59 | ▶ | while($token = $self->get_token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 522 | ▶ | if( ($type = $token->type) eq 'start' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 203 | ▶ | if(($tagname = $token->tagname) eq 'L') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 22 | ▶ | $linktype = $token->attr('type') || 'insane'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$token->attr('type') || 'insane'
MC/DC0%0/1
$token->attr('type') || 'insane'
$token->attr('type')
Truth table50%1/2
A
A= $token->attr('type')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 22 | $linkto = $self->do_link($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 22 | ▶ | if(defined $linkto and length $linkto) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $linkto and length $linkto
MC/DC0%0/2
defined $linkto and length $linkto
defined $linkto
length $linkto
Truth table33%1/3
A and B
A= defined $linktoB= length $linkto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 22 | esc($linkto); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # (Yes, SGML-escaping applies on top of %-escaping! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # But it's rarely noticeable in practice.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 22 | print $fh qq{<a href="$linkto" class="podlink$linktype"\n>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | print $fh "<a>"; # Yes, an 'a' element with no attributes! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | ▶ | } elsif ($tagname eq 'item-text' or $tagname =~ m/^head\d$/s) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$tagname eq "item-text" or $tagname =~ /^head\d$/s
MC/DC100%2/2
$tagname eq "item-text" or $tagname =~ /^head\d$/s
$tagname eq "item-text"
$tagname =~ /^head\d$/s
Truth table100%3/3
A or B
A= $tagname eq "item-text"B= $tagname =~ /^head\d$/s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 37 | ▶ | print $fh $tagmap->{$tagname} || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tagmap->{$tagname} || (next)
MC/DC0%0/1
$tagmap->{$tagname} || (next)
$tagmap->{$tagname}
Truth table50%1/2
A
A= $tagmap->{$tagname}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 37 | my @to_unget; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 37 | while(1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 85 | push @to_unget, $self->get_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 85 | ▶ | last if $to_unget[-1]->is_end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$to_unget[-1]->is_end and $to_unget[-1]->tagname eq $tagname
MC/DC100%2/2
$to_unget[-1]->is_end and $to_unget[-1]->tagname eq $tagname
$to_unget[-1]->is_end
$to_unget[-1]->tagname eq $tagname
Truth table100%3/3
A and B
A= $to_unget[-1]->is_endB= $to_unget[-1]->tagname eq $tagname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | and $to_unget[-1]->tagname eq $tagname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # TODO: support for X<...>'s found in here? (maybe hack into linearize_tokens) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 37 | my $name = $self->linearize_tokens(@to_unget); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 37 | ▶ | $name = $self->do_section($name, $token) if defined $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 37 | print $fh "<a "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 37 | ▶ | if ($tagname =~ m/^head\d$/s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 33 | ▶ | print $fh "class='u'", $self->index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | ? " href='#___top' title='click to go to top of document'\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | : "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 37 | ▶ | if(defined $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 37 | my $esc = esc( $self->section_name_tidy( $name ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 37 | print $fh qq[name="$esc"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 37 | DEBUG and print STDERR "Linearized ", scalar(@to_unget), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | " tokens as \"$name\".\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 31 | push @{ $self->{'PSHTML_index_points'} }, [$tagname, $name] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 37 | ▶ | if $ToIndex{ $tagname }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | # Obviously, this discards all formatting codes (saving | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | # just their content), but ahwell. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | } else { # ludicrously long, so nevermind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | DEBUG and print STDERR "Linearized ", scalar(@to_unget), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | " tokens, but it was too long, so nevermind.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 37 | print $fh "\n>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 37 | $self->unget_token(@to_unget); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } elsif ($tagname eq 'Data') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 4 | my $next = $self->get_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 4 | ▶ | next unless defined $next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 4 | ▶ | unless( $next->type eq 'text' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | $self->unget_token($next); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 4 | DEBUG and print STDERR " raw text ", $next->text, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # The parser sometimes preserves newlines and sometimes doesn't! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 4 | (my $text = $next->text) =~ s/\n\z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 4 | print $fh $text, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 140 | ▶ | if( $tagname =~ m/^over-/s ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 3 | push @stack, ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | ▶ | } elsif( $tagname =~ m/^item-/s and @stack and $stack[-1] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$tagname =~ /^item-/s and @stack and $stack[-1]
$tagname =~ /^item-/s and @stack
MC/DC0%0/3
$tagname =~ /^item-/s and @stack and $stack[-1]
$tagname =~ /^item-/s
@stack
$stack[-1]
Truth table25%1/4
A and B and C
A= $tagname =~ /^item-/sB= @stackC= $stack[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | print $fh $stack[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $stack[-1] = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 140 | ▶ | print $fh $tagmap->{$tagname} || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$tagmap->{$tagname} || (next)
MC/DC100%1/1
$tagmap->{$tagname} || (next)
$tagmap->{$tagname}
Truth table100%2/2
A
A= $tagmap->{$tagname}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 80 | ▶ | ++$dont_wrap if $tagname eq 'Verbatim' or $tagname eq "VerbatimFormatted" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$tagname eq "Verbatim" or $tagname eq "VerbatimFormatted" or $tagname eq "X"
$tagname eq "Verbatim" or $tagname eq "VerbatimFormatted"
MC/DC66%2/3
$tagname eq "Verbatim" or $tagname eq "VerbatimFormatted" or $tagname eq "X"
$tagname eq "Verbatim"
$tagname eq "VerbatimFormatted"
$tagname eq "X"
Truth table75%3/4
A or B or C
A= $tagname eq "Verbatim"B= $tagname eq "VerbatimFormatted"C= $tagname eq "X"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | or $tagname eq 'X'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } elsif( $type eq 'end' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 203 | ▶ | if( ($tagname = $token->tagname) =~ m/^over-/s ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 3 | ▶ | if( my $end = pop @stack ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 3 | print $fh $end; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | ▶ | } elsif( $tagname =~ m/^item-/s and @stack) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tagname =~ /^item-/s and @stack
MC/DC50%1/2
$tagname =~ /^item-/s and @stack
$tagname =~ /^item-/s
@stack
Truth table66%2/3
A and B
A= $tagname =~ /^item-/sB= @stack
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 4 | $stack[-1] = $tagmap->{"/$tagname"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 4 | ▶ | if( $tagname eq 'item-text' and defined(my $next = $self->get_token) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tagname eq "item-text" and defined(my $next = $self->get_token)
MC/DC0%0/2
$tagname eq "item-text" and defined(my $next = $self->get_token)
$tagname eq "item-text"
defined(my $next = $self->get_token)
Truth table33%1/3
A and B
A= $tagname eq "item-text"B= defined(my $next = $self->get_token)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 4 | $self->unget_token($next); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 4 | ▶ | if( $next->type eq 'start' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 3 | print $fh $tagmap->{"/item-text"},$tagmap->{"item-body"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 3 | $stack[-1] = $tagmap->{"/item-body"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 199 | ▶ | print $fh $tagmap->{"/$tagname"} || next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$tagmap{"/$tagname"} || (next)
MC/DC100%1/1
$$tagmap{"/$tagname"} || (next)
$$tagmap{"/$tagname"}
Truth table100%2/2
A
A= $$tagmap{"/$tagname"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 139 | ▶ | --$dont_wrap if $tagname eq 'Verbatim' or $tagname eq 'X'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tagname eq "Verbatim" or $tagname eq "X"
MC/DC50%1/2
$tagname eq "Verbatim" or $tagname eq "X"
$tagname eq "Verbatim"
$tagname eq "X"
Truth table66%2/3
A or B
A= $tagname eq "Verbatim"B= $tagname eq "X"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } elsif( $type eq 'text' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 116 | esc($type = $token->text); # reuse $type, why not | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 116 | ▶ | $type =~ s/([\?\!\"\'\.\,]) /$1\n/g unless $dont_wrap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 116 | print $fh $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 59 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | ########################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 36 | ▶ | sub do_section { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_section: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 36 | my($self, $name, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 36 | return $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 22 | ▶ | sub do_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_link: called CC=5 SCAR=17.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 22 | my($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 22 | my $type = $token->attr('type'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 22 | ▶ | if(!defined $type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $self->whine("Typeless L!?", $token->attr('start_line')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 10 | } elsif( $type eq 'pod') { return $self->do_pod_link($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 9 | } elsif( $type eq 'url') { return $self->do_url_link($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 3 | } elsif( $type eq 'man') { return $self->do_man_link($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | $self->whine("L of unknown type $type!?", $token->attr('start_line')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | return 'FNORG'; # should never get called | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 9 | ▶ | sub do_url_link { return $_[1]->attr('to') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_url_link: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 3 | ▶ | sub do_man_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_man_link: called CC=5 SCAR=16.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 3 | my ($self, $link) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 3 | my $to = $link->attr('to'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 3 | my $frag = $link->attr('section'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 3 | ▶ | return undef unless defined $to and length $to; # should never happen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $to and length $to
MC/DC0%0/2
defined $to and length $to
defined $to
length $to
Truth table33%1/3
A and B
A= defined $toB= length $to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 3 | ▶ | $frag = $self->section_escape($frag) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $frag and length(($frag .= ''))
MC/DC50%1/2
defined $frag and length(($frag .= ''))
defined $frag
length(($frag .= ''))
Truth table66%2/3
A and B
A= defined $fragB= length(($frag .= ''))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | if defined $frag and length($frag .= ''); # (stringify) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 3 | DEBUG and print STDERR "Resolving \"$to/$frag\"\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 3 | return $self->resolve_man_page_link($to, $frag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 10 | ▶ | sub do_pod_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_pod_link: called CC=19 SCAR=34.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | # And now things get really messy... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 10 | my($self, $link) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 10 | my $to = $link->attr('to'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 10 | my $section = $link->attr('section'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | return undef unless( # should never happen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 10 | ▶ | (defined $to and length $to) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $to and length $to or defined $section and length $section
defined $to and length $to
defined $section and length $section
MC/DC0%0/4
defined $to and length $to or defined $section and length $section
defined $to
length $to
defined $section
length $section
Truth table28%2/7
A and B or C and D
A= defined $toB= length $toC= defined $sectionD= length $section
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | (defined $section and length $section) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 10 | ▶ | $section = $self->section_escape($section) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $section and length(($section .= ''))
MC/DC50%1/2
defined $section and length(($section .= ''))
defined $section
length(($section .= ''))
Truth table66%2/3
A and B
A= defined $sectionB= length(($section .= ''))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | if defined $section and length($section .= ''); # (stringify) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 10 | DEBUG and printf STDERR "Resolving \"%s\" \"%s\"...\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | $to || "(nil)", $section || "(nil)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | # An early hack: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 10 | my $complete_url = $self->resolve_pod_link_by_table($to, $section); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 10 | ▶ | if( $complete_url ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | DEBUG > 1 and print STDERR "resolve_pod_link_by_table(T,S) gives ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | $complete_url, "\n (Returning that.)\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | return $complete_url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 10 | DEBUG > 4 and print STDERR " resolve_pod_link_by_table(T,S)", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | " didn't return anything interesting.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 10 | ▶ | if(defined $to and length $to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $to and length $to
MC/DC50%1/2
defined $to and length $to
defined $to
length $to
Truth table66%2/3
A and B
A= defined $toB= length $to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | # Give this routine first hack again | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 7 | my $there = $self->resolve_pod_link_by_table($to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 7 | ▶ | if(defined $there and length $there) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $there and length $there
MC/DC0%0/2
defined $there and length $there
defined $there
length $there
Truth table33%1/3
A and B
A= defined $thereB= length $there
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | DEBUG > 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | and print STDERR "resolve_pod_link_by_table(T) gives $there\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 7 | $there = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | $self->resolve_pod_page_link($to, $section); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | # (I pass it the section value, but I don't see a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | # particular reason it'd use it.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 7 | DEBUG > 1 and print STDERR "resolve_pod_page_link gives ", $there || "(nil)", "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 7 | ▶ | unless( defined $there and length $there ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $there and length $there
MC/DC0%0/2
defined $there and length $there
defined $there
length $there
Truth table33%1/3
A and B
A= defined $thereB= length $there
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | DEBUG and print STDERR "Can't resolve $to\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | # resolve_pod_page_link returning undef is how it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | # can signal that it gives up on making a link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 7 | $to = $there; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | #DEBUG and print STDERR "So far [", $to||'nil', "] [", $section||'nil', "]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 10 | ▶ | my $out = (defined $to and length $to) ? $to : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $to and length $to
MC/DC50%1/2
defined $to and length $to
defined $to
length $to
Truth table66%2/3
A and B
A= defined $toB= length $to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 10 | ▶ | $out .= "#" . $section if defined $section and length $section; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $section and length $section
MC/DC50%1/2
defined $section and length $section
defined $section
length $section
Truth table66%2/3
A and B
A= defined $sectionB= length $section
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 10 | ▶ | unless(length $out) { # sanity check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | DEBUG and printf STDERR "Oddly, couldn't resolve \"%s\" \"%s\"...\n", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | $to || "(nil)", $section || "(nil)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 10 | DEBUG and print STDERR "Resolved to $out\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 10 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 32 | ▶ | sub section_escape { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
section_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 32 | my($self, $section) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 32 | return $self->section_url_escape( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | $self->section_name_tidy($section) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 69 | ▶ | sub section_name_tidy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
section_name_tidy: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 69 | my($self, $section) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 69 | $section =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 69 | $section =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 69 | $section =~ tr/ /_/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 69 | ▶ | if ("$]" >= 5.006) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 69 | $section =~ s/[[:cntrl:][:^ascii:]]//g; # drop crazy characters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | } elsif ('A' eq chr(65)) { # But not on early EBCDIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $section =~ tr/\x00-\x1F\x80-\x9F//d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 69 | $section = $self->unicode_escape_url($section); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 69 | ▶ | $section = '_' unless length $section; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 69 | return $section; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 32 | ▶ | sub section_url_escape { shift->general_url_escape(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
section_url_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 7 | ▶ | sub pagepath_url_escape { shift->general_url_escape(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pagepath_url_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 3 | ▶ | sub manpage_url_escape { shift->general_url_escape(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
manpage_url_escape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 42 | ▶ | sub general_url_escape { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
general_url_escape: called CC=2 SCAR=7.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 42 | my($self, $string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | $string =~ s/([^\x00-\xFF])/join '', map sprintf('%%%02X',$_), unpack 'C*', $1/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | # express Unicode things as urlencode(utf(orig)). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | # A pretty conservative escaping, behoovey even for query components | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # of a URL (see RFC 2396) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 42 | ▶ | if ("$]" >= 5.007_003) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 42 | $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',utf8::native_to_unicode(ord($1)))/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } else { # Is broken for non-ASCII platforms on early perls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $string =~ s/([^-_\.!~*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf('%%%02X',ord($1))/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | # Yes, stipulate the list without a range, so that this can work right on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | # all charsets that this module happens to run under. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 42 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | #-------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | # Oh look, a yawning portal to Hell! Let's play touch football right by it! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 7 | ▶ | sub resolve_pod_page_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_pod_page_link: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | # resolve_pod_page_link must return a properly escaped URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 7 | ▶ | return $self->batch_mode() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | ? $self->resolve_pod_page_link_batch_mode(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | : $self->resolve_pod_page_link_singleton_mode(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 7 | ▶ | sub resolve_pod_page_link_singleton_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_pod_page_link_singleton_mode: called CC=5 SCAR=17.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 7 | my($self, $it) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 7 | ▶ | return undef unless defined $it and length $it; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $it and length $it
MC/DC0%0/2
defined $it and length $it
defined $it
length $it
Truth table33%1/3
A and B
A= defined $itB= length $it
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 7 | my $url = $self->pagepath_url_escape($it); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 7 | $url =~ s{::$}{}s; # probably never comes up anyway | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 7 | ▶ | $url =~ s{::}{/}g unless $self->perldoc_url_prefix =~ m/\?/s; # sane DWIM? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 7 | ▶ | return undef unless length $url; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 7 | return $self->perldoc_url_prefix . $url . $self->perldoc_url_postfix; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | sub resolve_pod_page_link_batch_mode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_pod_page_link_batch_mode: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | my($self, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | DEBUG > 1 and print STDERR " During batch mode, resolving $to ...\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my @path = grep length($_), split m/::/s, $to, -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | unless( @path ) { # sanity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | DEBUG and print STDERR "Very odd! Splitting $to gives (nil)!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | $self->batch_mode_rectify_path(\@path); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $out = join('/', map $self->pagepath_url_escape($_), @path) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | . $HTML_EXTENSION; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | DEBUG > 1 and print STDERR " => $out\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | sub batch_mode_rectify_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
batch_mode_rectify_path: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my($self, $pathbits) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | my $level = $self->batch_mode_current_level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | $level--; # how many levels up to go to get to the root | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | if($level < 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | unshift @$pathbits, '.'; # just to be pretty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | unshift @$pathbits, ('..') x $level; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 3 | ▶ | sub resolve_man_page_link { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_man_page_link: called CC=5 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 3 | my ($self, $to, $frag) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 3 | my ($page, $section) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 3 | ▶ | return undef unless defined $page and length $page; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $page and length $page
MC/DC0%0/2
defined $page and length $page
defined $page
length $page
Truth table33%1/3
A and B
A= defined $pageB= length $page
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 3 | ▶ | $section ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$section ||= 1
MC/DC0%0/1
$section ||= 1
$section
Truth table50%1/2
A
A= $section
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 3 | ▶ | return $self->man_url_prefix . "$section/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | . $self->manpage_url_escape($page) . ".$section" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | . $self->man_url_postfix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | . (defined $frag ? '#' . $frag : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 17 | ▶ | sub resolve_pod_link_by_table { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_pod_link_by_table: called CC=5 SCAR=30.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | # A crazy hack to allow specifying custom L<foo> => URL mappings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 17 | ▶ | return unless $_[0]->{'podhtml_LOT'}; # An optimizy shortcut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | my($self, $to, $section) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # TODO: add a method that actually populates podhtml_LOT from a file? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | if(defined $section) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | $to = '' unless defined $to and length $to; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $to and length $to
MC/DC0%0/2
defined $to and length $to
defined $to
length $to
Truth table0%0/3
A and B
A= defined $toB= length $to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | return $self->{'podhtml_LOT'}{"$to#$section"}; # quite possibly undef! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return $self->{'podhtml_LOT'}{$to}; # quite possibly undef! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | ########################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | 37 | ▶ | sub linearize_tokens { # self, tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
linearize_tokens: called CC=14 SCAR=29.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 37 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 37 | my $out = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 37 | my $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 37 | ▶ | while($t = shift @_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 79 | ▶ | if(!ref $t or !UNIVERSAL::can($t, 'is_text')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
ref $t && UNIVERSAL::can($t, 'is_text')
MC/DC0%0/2
ref $t && UNIVERSAL::can($t, 'is_text')
ref $t
UNIVERSAL::can($t, 'is_text')
Truth table33%1/3
A && B
A= ref $tB= UNIVERSAL::can($t, 'is_text')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | $out .= $t; # a string, or some insane thing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | } elsif($t->is_text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 39 | $out .= $t->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | ▶ | } elsif($t->is_start and $t->tag eq 'X') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$t->is_start and $t->tag eq "X"
MC/DC50%1/2
$t->is_start and $t->tag eq "X"
$t->is_start
$t->tag eq "X"
Truth table66%2/3
A and B
A= $t->is_startB= $t->tag eq "X"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | # Ignore until the end of this X<...> sequence: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 3 | my $x_open = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 3 | ▶ | while($x_open) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 6 | ▶ | next if( ($t = shift @_)->is_text ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | if( $t->is_start and $t->tag eq 'X') { ++$x_open } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$t->is_start and $t->tag eq "X"
MC/DC0%0/2
$t->is_start and $t->tag eq "X"
$t->is_start
$t->tag eq "X"
Truth table33%1/3
A and B
A= $t->is_startB= $t->tag eq "X"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 3 | ▶ | elsif($t->is_end and $t->tag eq 'X') { --$x_open } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$t->is_end and $t->tag eq "X"
MC/DC0%0/2
$t->is_end and $t->tag eq "X"
$t->is_end
$t->tag eq "X"
Truth table33%1/3
A and B
A= $t->is_endB= $t->tag eq "X"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 37 | ▶ | return undef if length $out > $Linearization_Limit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 37 | return $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 69 | ▶ | sub unicode_escape_url { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unicode_escape_url: called CC=1 SCAR=0.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 69 | my($self, $string) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | $string =~ s/([^\x00-\xFF])/'('.ord($1).')'/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | # Turn char 1234 into "(1234)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 69 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 464 | ▶ | sub esc { # a function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
esc: called CC=7 SCAR=21.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 464 | ▶ | if(defined wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 326 | ▶ | if(wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 275 | @_ = splice @_; # break aliasing | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 51 | my $x = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 51 | ▶ | if ("$]" >= 5.007_003) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | } else { # Is broken for non-ASCII platforms on early perls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 51 | return $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 413 | foreach my $x (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | # Escape things very cautiously: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 1101 | ▶ | if (defined $x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | 1101 | ▶ | if ("$]" >= 5.007_003) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 1101 | $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(utf8::native_to_unicode(ord($1))).';'/eg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | } else { # Is broken for non-ASCII platforms on early perls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | $x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/'&#'.(ord($1)).';'/eg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | # Leave out "- so that "--" won't make it thru in X-generated comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | # with text in them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | # Yes, stipulate the list without a range, so that this can work right on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | # all charsets that this module happens to run under. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 413 | return @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||