pod2html: render without stylesheet by default (#4016)

fixes #3956
next
Michael Stapelberg 2020-04-12 11:07:43 +02:00 committed by GitHub
parent 46e940efba
commit e7191af8b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 8 deletions

View File

@ -4,8 +4,14 @@
use strict;
use warnings;
use Pod::Simple::HTML;
use Getopt::Long;
use v5.10;
my $stylesurl = '';
GetOptions("stylesurl=s" => \$stylesurl)
or die "parsing flags";
$Pod::Simple::HTML::Tagmap{'Verbatim'} = '<pre><tt>';
$Pod::Simple::HTML::Tagmap{'VerbatimFormatted'} = '<pre><tt>';
$Pod::Simple::HTML::Tagmap{'/Verbatim'} = '</tt></pre>';
@ -22,8 +28,9 @@ open(my $out, '>', $ARGV[1]) or die "Couldnt open $ARGV[1] for writing: $!\n"
my $parser = Pod::Simple::HTML->new();
$parser->index(1);
$parser->html_header_before_title(
<<'EOF'
if ($stylesurl ne '') {
$parser->html_header_before_title(
<<EOF
<!doctype html>
<html lang="en">
<head>
@ -31,7 +38,7 @@ $parser->html_header_before_title(
<meta charset="utf-8">
<meta name="generator" content="Pod::Simple::HTML">
<meta name="description" content="i3 Perl documentation">
<link rel="stylesheet" href="https://i3wm.org/css/style.css" type="text/css" />
<link rel="stylesheet" href="$stylesurl/style.css" type="text/css" />
<style type="text/css">
.pod pre {
background: #333;
@ -63,7 +70,8 @@ tt {
</style>
<title>
EOF
);
);
}
$parser->html_header_after_title(
<<'EOF'
</title>

View File

@ -7,10 +7,10 @@ for f in $(grep '\.html$' debian/i3-wm.docs | grep -v 'docs/refcard.html' | grep
do
asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf $(dirname $f)/$(basename $f .html)
done
./docs/i3-pod2html i3-dmenu-desktop man/i3-dmenu-desktop.html
./docs/i3-pod2html i3-save-tree man/i3-save-tree.html
./docs/i3-pod2html build/testcases/lib/i3test.pm docs/lib-i3test.html
./docs/i3-pod2html testcases/lib/i3test/Test.pm docs/lib-i3test-test.html
./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-dmenu-desktop man/i3-dmenu-desktop.html
./docs/i3-pod2html --stylesurl=https://i3wm.org/css i3-save-tree man/i3-save-tree.html
./docs/i3-pod2html --stylesurl=https://i3wm.org/css build/testcases/lib/i3test.pm docs/lib-i3test.html
./docs/i3-pod2html --stylesurl=https://i3wm.org/css testcases/lib/i3test/Test.pm docs/lib-i3test-test.html
for file in $(sed 's/\.1$/.man/g' debian/i3-wm.manpages)
do
[ -f "$file" ] && asciidoc -a linkcss -a stylesdir=https://i3wm.org/css -a scriptsdir=https://i3wm.org/js --backend=xhtml11 -f docs/asciidoc-git.conf "$file"