+
+# try to generate output file mapping
+foreach my $e (@$start_env) {
+ my $toplevel_hash = $fileinfo->{toplevel}->{$e};
+ foreach my $fn (sort keys %$toplevel_hash) {
+ my $mansection = $fileinfo->{mansection}->{manvolnum}->{$fn};
+ if ($e eq 'wiki') {
+ my $realfn = $fn;
+ $realfn =~ s/\.adoc$//;
+ if (defined($mansection) && ($mansection == 5)) {
+ $realfn .= ".$mansection";
+ }
+ $realfn = "$realfn-plain.html";
+ $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
+ } elsif ($e eq 'manvolnum') {
+ my $realfn = $fn;
+ $realfn =~ s/\.adoc$//;
+ die "toplevel file '$fn' is not marked as manual page!" if !$mansection;
+ $realfn .= ".$mansection";
+ $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
+ } elsif ($e eq 'default') {
+ my $realfn = $fn;
+ $realfn =~ s/\.adoc$//;
+ if (defined($mansection) && ($mansection == 5)) {
+ $realfn .= ".$mansection";
+ $realfn = "$realfn.html";
+ } else {
+ if (($fn ne 'pve-admin-guide.adoc') &&
+ $fileinfo->{doctype}->{$e}->{$fn} == 0) {
+ $realfn = "chapter-$realfn.html";
+ } else {
+ $realfn = "$realfn.html";
+ }
+ }
+ $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
+ }
+ }
+}
+