Subject: | stylesheet reference broken with https (with patch) |
If the output document is to be served by https (becoming a requirement these days),
the stylsheet can't be accessed. This is because it generates a stylesheet reference
to http://search.cpan.org/s/style.css. The stylesheet is blocked as "mixed content"
by current browsers.
Unfortunately, search.cpan.org doesn't offer https. Some environments may also prefer to
have the stylesheet local - e.g. for documents viewed off-line.
Thus, pod2cpanhtml needs an option to specify the stylesheet URL.
The attached patch implements this as --cssurl=foo, with the default remaining the same.
E.g.
pod2cpanhtml --css=cpanstyle.css foo.pod | grep stylesheet will produce:
<link rel="stylesheet" type="text/css" title="pod_stylesheet" href="cpanstyle.css">
I've tentatively called this 0.05...
Subject: | pod2cpanhtml.patch |
diff -r -U5 App-Pod2CpanHtml-0.04/bin/pod2cpanhtml App-Pod2CpanHtml-0.05/bin/pod2cpanhtml
--- App-Pod2CpanHtml-0.04/bin/pod2cpanhtml 2009-12-03 17:51:59.000000000 -0500
+++ App-Pod2CpanHtml-0.05/bin/pod2cpanhtml 2017-05-13 08:19:23.000000000 -0400
@@ -19,18 +19,20 @@
my $whine = 1;
my $errata = 1;
my $complain = 0;
my $index = 1;
my $version = 0;
+my $css = '';
GetOptions(
'help|?' => \$help,
'man' => \$man,
'whine!' => \$whine,
'errata!' => \$errata,
'complain!' => \$complain,
'index|i!' => \$index,
+ 'cssurl|c=s'=> \$css,
'version|v' => \$version,
) or pod2usage(2);
die "pod2cpanhtml, version $App::Pod2CpanHtml::VERSION\n" if $version;
@@ -38,11 +40,11 @@
pod2usage( -verbose => 2 ) if $man;
# From the Pod::Usage pod:
pod2usage() if @ARGV == 0 && -t STDIN;
-my $parser = App::Pod2CpanHtml->new();
+my $parser = App::Pod2CpanHtml->new( css => $css );
if ( defined $ARGV[0] ) {
open IN, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n";
}
else {
@@ -72,10 +74,11 @@
pod2cpanhtml [options] podfile [outfile]
Options:
--index Generate a HTML index in output doc (the default).
+ --cssurl= Specify an alternate url for the CSS stylesheet
--help Print a brief help message.
--man Print the full manpage.
--version Print the version of the program.
--errata Flag any Pod errors at the end of the doc (the default).
@@ -103,10 +106,18 @@
=item B<outfile>
The converted output file in HTML format. Defaults to stdout if not specified.
+=item B<--cssurl>=I<URL>
+
+Specifies I<URL> for the stylesheet rather than
+F<http://search.cpan.org/s/style.css>. Use this with a downloaded copy of
+the B<CPAN> stylesheet if you are serving your content as an F<https://>
+page to avoid mixed content warnings. Or if you don't want to rely on
+the B<CPAN> CDN. I<URL> can be absolute or relative.
+
=item B<--index or -i>
Generate a HTML index in the output document. This is the default. To turn the index off use C<--no-index> or C<-no-i>.
=item B<--help or -h>
Only in App-Pod2CpanHtml-0.05/bin: pod2cpanhtml~
diff -r -U5 App-Pod2CpanHtml-0.04/Changes App-Pod2CpanHtml-0.05/Changes
--- App-Pod2CpanHtml-0.04/Changes 2012-12-09 12:50:41.000000000 -0500
+++ App-Pod2CpanHtml-0.05/Changes 2017-05-13 08:20:47.000000000 -0400
@@ -1,7 +1,11 @@
Revision history for App-Pod2CpanHtml
+0.05 May 13 2017
+
+ Add support for --cssurl
+
0.04 Dec 9 2012
! Fixed typo in docs. RT#71307.
Thanks to John P. Linderman.
diff -r -U5 App-Pod2CpanHtml-0.04/lib/App/Pod2CpanHtml.pm App-Pod2CpanHtml-0.05/lib/App/Pod2CpanHtml.pm
--- App-Pod2CpanHtml-0.04/lib/App/Pod2CpanHtml.pm 2012-12-09 12:48:54.000000000 -0500
+++ App-Pod2CpanHtml-0.05/lib/App/Pod2CpanHtml.pm 2017-05-13 08:19:26.000000000 -0400
@@ -14,24 +14,27 @@
use Pod::Simple::HTML;
use vars qw(@ISA $VERSION);
@ISA = 'Pod::Simple::HTML';
-$VERSION = '0.04';
+$VERSION = '0.05';
###############################################################################
#
# new()
#
# Simple constructor inheriting from Pod::Simple::HTML.
#
sub new {
my $class = shift;
- my $self = Pod::Simple::HTML->new(@_);
+ my %args = @_;
+ my $css = delete $args{css} ||
+ 'http://search.cpan.org/s/style.css';
+ my $self = Pod::Simple::HTML->new(%args);
$self->{index} = 1;
- $self->{html_css} = 'http://search.cpan.org/s/style.css';
+ $self->{html_css} = $css;
bless $self, $class;
return $self;
}
Only in App-Pod2CpanHtml-0.05/lib/App: Pod2CpanHtml.pm~