Skip to content

Commit 54540d8

Browse files
rwp0khwilliamson
authored andcommitted
Point manpages to man7.org (HTTPS)
Instead of HTTP-only man.he.net Avoiding "Not secure" warnings thereby Fixes #150
1 parent 506b8a3 commit 54540d8

File tree

4 files changed

+30
-36
lines changed

4 files changed

+30
-36
lines changed

lib/Pod/Simple/HTML.pm

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ $Perldoc_URL_Postfix = ''
3535
unless defined $Perldoc_URL_Postfix;
3636

3737

38-
our $Man_URL_Prefix = 'http://man.he.net/man';
39-
our $Man_URL_Postfix = '';
38+
our $Man_URL_Prefix = 'https://man7.org/linux/man-pages/man';
39+
our $Man_URL_Postfix = '.html';
4040

4141
our $Title_Prefix;
4242
$Title_Prefix = '' unless defined $Title_Prefix;
@@ -59,7 +59,7 @@ __PACKAGE__->_accessorize(
5959
# In turning L<crontab(5)> into http://whatever/man/1/crontab, what
6060
# to put before the "1/crontab".
6161
'man_url_postfix',
62-
# what to put after the "1/crontab" in the URL. Normally "".
62+
# what to put after the "1/crontab" in the URL. Normally ".html".
6363

6464
'batch_mode', # whether we're in batch mode
6565
'batch_mode_current_level',
@@ -797,7 +797,7 @@ sub resolve_man_page_link {
797797
$section ||= 1;
798798

799799
return $self->man_url_prefix . "$section/"
800-
. $self->manpage_url_escape($page)
800+
. $self->manpage_url_escape($page) . ".$section"
801801
. $self->man_url_postfix;
802802
}
803803

@@ -1136,11 +1136,6 @@ This program is distributed in the hope that it will be useful, but
11361136
without any warranty; without even the implied warranty of
11371137
merchantability or fitness for a particular purpose.
11381138
1139-
=head1 ACKNOWLEDGEMENTS
1140-
1141-
Thanks to L<Hurricane Electric|http://he.net/> for permission to use its
1142-
L<Linux man pages online|http://man.he.net/> site for man page links.
1143-
11441139
=head1 AUTHOR
11451140
11461141
Pod::Simple was created by Sean M. Burke <[email protected]>.

lib/Pod/Simple/XHTML.pm

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,14 @@ default.
129129
130130
=head2 man_url_prefix
131131
132-
In turning C<< L<crontab(5)> >> into http://whatever/man/1/crontab, what
133-
to put before the "1/crontab". The default value is
134-
"http://man.he.net/man".
132+
In turning C<< L<crontab(5)> >> into http://whatever/man/1/crontab.1, what
133+
to put before the "1/crontab.1". The default value is
134+
"https://man7.org/linux/man-pages/man".
135135
136136
=head2 man_url_postfix
137137
138-
What to put after "1/crontab" in the URL. This option is not set by default.
138+
What to put after "1/crontab.1" in the URL.
139+
This option is set to ".html" by default.
139140
140141
=head2 title_prefix, title_postfix
141142
@@ -276,7 +277,8 @@ sub new {
276277
my $new = $self->SUPER::new(@_);
277278
$new->{'output_fh'} ||= *STDOUT{IO};
278279
$new->perldoc_url_prefix('https://metacpan.org/pod/');
279-
$new->man_url_prefix('http://man.he.net/man');
280+
$new->man_url_prefix('https://man7.org/linux/man-pages/man');
281+
$new->man_url_postfix('.html');
280282
$new->html_charset('ISO-8859-1');
281283
$new->nix_X_codes(1);
282284
$new->{'scratch'} = '';
@@ -774,25 +776,25 @@ sub resolve_pod_page_link {
774776
Resolves a man page link target and numeric section to a URL. The resulting
775777
link will be returned for the above examples as:
776778
777-
http://man.he.net/man5/crontab
778-
http://man.he.net/man1/crontab
779+
https://man7.org/linux/man-pages/man5/crontab.5.html
780+
https://man7.org/linux/man-pages/man1/crontab.1.html
779781
780782
Note that the first argument is required. The section number will be parsed
781783
from it, and if it's missing will default to 1. The second argument is
782-
currently ignored, as L<man.he.net|http://man.he.net> does not currently
783-
include linkable IDs or anchor names in its pages. Subclass to link to a
784-
different man page HTTP server.
784+
currently ignored. Subclass to link to a different man page HTTP server.
785785
786786
=cut
787787

788788
sub resolve_man_page_link {
789789
my ($self, $to, $section) = @_;
790790
return undef unless defined $to;
791+
791792
my ($page, $part) = $to =~ /^([^(]+)(?:[(](\d+)[)])?$/;
792793
return undef unless $page;
794+
793795
return ($self->man_url_prefix || '')
794796
. ($part || 1) . "/" . $self->encode_entities($page)
795-
. ($self->man_url_postfix || '');
797+
. "." . ($part || 1) . ($self->man_url_postfix || '');
796798

797799
}
798800

@@ -905,11 +907,6 @@ This program is distributed in the hope that it will be useful, but
905907
without any warranty; without even the implied warranty of
906908
merchantability or fitness for a particular purpose.
907909
908-
=head1 ACKNOWLEDGEMENTS
909-
910-
Thanks to L<Hurricane Electric|http://he.net/> for permission to use its
911-
L<Linux man pages online|http://man.he.net/> site for man page links.
912-
913910
=head1 AUTHOR
914911
915912
Pod::Simple::XHTML was created by Allison Randal <[email protected]>.

t/fcodes_s.t

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ is(
215215
# Test HTML output of links.
216216
use Pod::Simple::HTML;
217217
my $PERLDOC = "https://metacpan.org/pod";
218-
my $MANURL = "http://man.he.net/man";
218+
my $MANURL = "https://man7.org/linux/man-pages/man";
219+
my $MANURL_POSTFIX = ".html";
219220
sub x {
220221
Pod::Simple::HTML->_out(
221222
sub { $_[0]->bare_output(1) },
@@ -240,7 +241,7 @@ is(
240241

241242
is(
242243
x(qq{L<crontab(5)>\n}),
243-
qq{\n<p><a href="${MANURL}5/crontab" class="podlinkman"\n>crontab(5)</a></p>\n}
244+
qq{\n<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}" class="podlinkman"\n>crontab(5)</a></p>\n}
244245
);
245246

246247
is(
@@ -300,12 +301,12 @@ is(
300301

301302
is(
302303
x(qq{L<things|crontab(5)>\n}),
303-
qq{\n<p><a href="${MANURL}5/crontab" class="podlinkman"\n>things</a></p>\n}
304+
qq{\n<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}" class="podlinkman"\n>things</a></p>\n}
304305
);
305306

306307
is(
307308
x(qq{L<things|crontab(5)/ENVIRONMENT>\n}),
308-
qq{\n<p><a href="${MANURL}5/crontab" class="podlinkman"\n>things</a></p>\n}
309+
qq{\n<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}" class="podlinkman"\n>things</a></p>\n}
309310
);
310311

311312
is(
@@ -362,7 +363,7 @@ is(
362363

363364
is(
364365
o(qq{L<crontab(5)>}),
365-
qq{<p><a href="${MANURL}5/crontab">crontab(5)</a></p>\n\n}
366+
qq{<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}">crontab(5)</a></p>\n\n}
366367
);
367368

368369
is(
@@ -422,12 +423,12 @@ is(
422423

423424
is(
424425
o(qq{L<things|crontab(5)>}),
425-
qq{<p><a href="${MANURL}5/crontab">things</a></p>\n\n}
426+
qq{<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}">things</a></p>\n\n}
426427
);
427428

428429
is(
429430
o(qq{L<things|crontab(5)/ENVIRONMENT>}),
430-
qq{<p><a href="${MANURL}5/crontab">things</a></p>\n\n}
431+
qq{<p><a href="${MANURL}5/crontab.5${MANURL_POSTFIX}">things</a></p>\n\n}
431432
);
432433

433434
is(

t/xhtml01.t

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ isa_ok ($parser, 'Pod::Simple::XHTML');
1111
my $results;
1212

1313
my $PERLDOC = "https://metacpan.org/pod";
14-
my $MANURL = "http://man.he.net/man";
14+
my $MANURL = "https://man7.org/linux/man-pages/man";
15+
my $MANURL_POSTFIX = ".html";
1516

1617
initialize($parser, $results);
1718
$parser->parse_string_document( "=head1 Poit!" );
@@ -788,11 +789,11 @@ is $parser->resolve_pod_page_link('perlpod', 'this that'),
788789
'POD link with fragment with space';
789790

790791
is $parser->resolve_man_page_link('crontab(5)', 'EXAMPLE CRON FILE'),
791-
"${MANURL}5/crontab", 'Man link with fragment';
792+
"${MANURL}5/crontab.5${MANURL_POSTFIX}", 'Man link with fragment';
792793
is $parser->resolve_man_page_link('crontab(5)'),
793-
"${MANURL}5/crontab", 'Man link without fragment';
794+
"${MANURL}5/crontab.5${MANURL_POSTFIX}", 'Man link without fragment';
794795
is $parser->resolve_man_page_link('crontab'),
795-
"${MANURL}1/crontab", 'Man link without section';
796+
"${MANURL}1/crontab.1${MANURL_POSTFIX}", 'Man link without section';
796797

797798
# Make sure that batch_mode_page_object_init() works.
798799
ok $parser->batch_mode_page_object_init(0, 0, 0, 0, 6),

0 commit comments

Comments
 (0)