mirror of
https://git.proxmox.com/git/pve-docs
synced 2025-04-30 16:58:12 +00:00
asciidoc-pve: small code/style cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
afb9056593
commit
3bd81d8da2
@ -259,16 +259,14 @@ sub compile_asciidoc {
|
|||||||
|
|
||||||
my $outfile;
|
my $outfile;
|
||||||
|
|
||||||
GetOptions ("outfile=s" => \$outfile,
|
GetOptions (
|
||||||
|
"outfile=s" => \$outfile,
|
||||||
"keep-artifacts" => \$keep_artifacts,
|
"keep-artifacts" => \$keep_artifacts,
|
||||||
"verbose" => \$verbose) or
|
"verbose" => \$verbose
|
||||||
die("Error in command line arguments\n");
|
) or die("Error in command line arguments\n");
|
||||||
|
|
||||||
my $infile = shift(@ARGV) or
|
my $infile = shift(@ARGV) or die "no input file specified\n";
|
||||||
die "no input file specified\n";
|
scalar(@ARGV) == 0 or die "too many arguments...\n";
|
||||||
|
|
||||||
scalar(@ARGV) == 0 or
|
|
||||||
die "too many arguments...\n";
|
|
||||||
|
|
||||||
my $outfilemap = $fileinfo->{outfile}->{$env}->{$infile} ||
|
my $outfilemap = $fileinfo->{outfile}->{$env}->{$infile} ||
|
||||||
die "no output file mapping for '$infile' ($env)";
|
die "no output file mapping for '$infile' ($env)";
|
||||||
@ -280,14 +278,12 @@ sub compile_asciidoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (defined($outfile)) {
|
if (defined($outfile)) {
|
||||||
die "wrong output file name '$outfile != $outfilemap' ($env)"
|
die "wrong output file name '$outfile != $outfilemap' ($env)" if $outfile ne $outfilemap;
|
||||||
if $outfile ne $outfilemap;
|
|
||||||
} else {
|
} else {
|
||||||
$outfile = $outfilemap;
|
$outfile = $outfilemap;
|
||||||
}
|
}
|
||||||
|
|
||||||
defined($fileinfo->{titles}->{$env}) ||
|
defined($fileinfo->{titles}->{$env}) || die "unknown environment '$env'";
|
||||||
die "unknown environment '$env'";
|
|
||||||
|
|
||||||
my $title = $fileinfo->{titles}->{$env}->{$infile} or
|
my $title = $fileinfo->{titles}->{$env}->{$infile} or
|
||||||
die "unable to get title for '$infile'$env\n";
|
die "unable to get title for '$infile'$env\n";
|
||||||
@ -350,9 +346,13 @@ sub compile_asciidoc {
|
|||||||
# section like footnotes, so we cannot use a2x.
|
# section like footnotes, so we cannot use a2x.
|
||||||
# We use xmlto instead.
|
# We use xmlto instead.
|
||||||
|
|
||||||
my $cmd = ['asciidoc', '-dmanpage', '-bdocbook',
|
my $cmd = [
|
||||||
|
'asciidoc',
|
||||||
|
'-dmanpage',
|
||||||
|
'-bdocbook',
|
||||||
'-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf",
|
'-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf",
|
||||||
'-a', 'docinfo1'];
|
'-a', 'docinfo1',
|
||||||
|
];
|
||||||
|
|
||||||
foreach my $key (keys %$attributes) {
|
foreach my $key (keys %$attributes) {
|
||||||
my $value = $attributes->{$key};
|
my $value = $attributes->{$key};
|
||||||
@ -377,8 +377,7 @@ sub compile_asciidoc {
|
|||||||
|
|
||||||
debug("run " . join(' ', @$cmd));
|
debug("run " . join(' ', @$cmd));
|
||||||
|
|
||||||
system(@$cmd) == 0 or
|
system(@$cmd) == 0 or die "aciidoc error";
|
||||||
die "aciidoc error";
|
|
||||||
|
|
||||||
$cmd = ['xmlto', 'man', $tmpxmlfile];
|
$cmd = ['xmlto', 'man', $tmpxmlfile];
|
||||||
|
|
||||||
@ -386,17 +385,14 @@ sub compile_asciidoc {
|
|||||||
|
|
||||||
debug("run " . join(' ', @$cmd));
|
debug("run " . join(' ', @$cmd));
|
||||||
|
|
||||||
system(@$cmd) == 0 or
|
system(@$cmd) == 0 or die "xmlto error";
|
||||||
die "xmlto error";
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$attributes->{icons} = undef;
|
$attributes->{icons} = undef;
|
||||||
$attributes->{'data-uri'} = undef;
|
$attributes->{'data-uri'} = undef;
|
||||||
|
|
||||||
my $cmd = ['asciidoc',
|
my $cmd = [ 'asciidoc', '-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf" ];
|
||||||
'-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf",
|
|
||||||
];
|
|
||||||
|
|
||||||
if (($env eq 'wiki') ||
|
if (($env eq 'wiki') ||
|
||||||
(($env eq 'manvolnum') && ($man_target eq 'wiki'))) {
|
(($env eq 'manvolnum') && ($man_target eq 'wiki'))) {
|
||||||
@ -425,8 +421,7 @@ sub compile_asciidoc {
|
|||||||
|
|
||||||
debug("run " . join(' ', @$cmd));
|
debug("run " . join(' ', @$cmd));
|
||||||
|
|
||||||
system(@$cmd) == 0 or
|
system(@$cmd) == 0 or die "aciidoc error";
|
||||||
die "aciidoc error";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user