+ if ($env eq 'manvolnum') {
+ if (($man_target eq 'html') || ($man_target eq 'wiki')) {
+ $outfile .= ".$mansection.html";
+ } else {
+ $outfile .= ".$mansection";
+ }
+ } else {
+ $outfile .= ".html";
+ }
+ }
+
+ if (($env eq 'manvolnum') && ($man_target eq 'man')) {
+
+ # asciidoc /etc/asciidoc/docbook-xsl/manpage.xsl skip REFERENCES
+ # section like footnotes, so we cannot use a2x.
+ # We use xmlto instead.
+
+ my $cmd = [
+ 'asciidoc',
+ '-dmanpage',
+ '-b', "$adoc_source_dir/asciidoc/pve-docbook",
+ '-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf",
+ '-a', 'docinfo1',
+ ];
+
+ foreach my $key (keys %$attributes) {
+ my $value = $attributes->{$key};
+ if (defined($value)) {
+ push @$cmd, '-a', "$key=$value";
+ } else {
+ push @$cmd, '-a', $key;
+ }
+ }
+
+ push @$cmd, '--verbose' if $verbose;
+
+ my $tmpxmlfile = "${outfile}.xml.tmp";
+
+ push @$cmd, '--out-file', $tmpxmlfile;
+
+ push @$files_for_cleanup, $tmpxmlfile;
+
+ my $new_infile = prepare_adoc_file($env, $infile, $attributes);
+
+ push @$cmd, $new_infile;
+
+ debug("run " . join(' ', @$cmd));
+
+ system(@$cmd) == 0 or die "aciidoc error";
+
+ $cmd = ['xmlto', 'man', $tmpxmlfile];
+
+ push @$cmd, '-v' if $verbose;
+
+ debug("run " . join(' ', @$cmd));
+
+ system(@$cmd) == 0 or die "xmlto error";
+
+ } else {
+
+ $attributes->{icons} = undef;
+ $attributes->{'data-uri'} = undef;
+
+ my $cmd = [ 'asciidoc', '-f', "$adoc_source_dir/asciidoc/asciidoc-pve.conf" ];
+
+ if (($env eq 'wiki') ||
+ (($env eq 'manvolnum') && ($man_target eq 'wiki'))) {
+
+ push @$cmd, '-b', "$adoc_source_dir/asciidoc/mediawiki";
+ } else {
+ push @$cmd, '-b', "$adoc_source_dir/asciidoc/pve-html";
+ }
+
+ foreach my $key (keys %$attributes) {
+ my $value = $attributes->{$key};
+ if (defined($value)) {
+ push @$cmd, '-a', "$key=$value";
+ } else {
+ push @$cmd, '-a', $key;
+ }
+ }
+
+ push @$cmd, '--verbose' if $verbose;
+
+ push @$cmd, '--out-file', $outfile;
+
+ my $new_infile = prepare_adoc_file($env, $infile, $attributes);
+
+ push @$cmd, $new_infile;
+
+ debug("run " . join(' ', @$cmd));
+
+ system(@$cmd) == 0 or die "aciidoc error";