use fixed output file mapping
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 14 Oct 2016 03:59:05 +0000 (05:59 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 14 Oct 2016 03:59:05 +0000 (05:59 +0200)
asciidoc-pve.in
scan-adoc-refs

index e7a6afb..97c5bf2 100644 (file)
@@ -260,6 +260,18 @@ sub compile_asciidoc {
     scalar(@ARGV) == 0 or
        die "too many arguments...\n";
 
+    my $outfilemap = $fileinfo->{outfile}->{$env}->{$infile} ||
+       die "no output file mapping '$infile => $outfile' ($env)";
+
+    if ($man_target eq 'html') {
+       $outfilemap .= '.html';
+    } elsif ($man_target eq 'wiki') {
+       $outfilemap .= '-plain.html';
+    }
+
+    die "wrong output file name '$outfile != $outfilemap' ($env)"
+       if $outfile ne $outfilemap;
+
     defined($fileinfo->{titles}->{$env}) ||
        die "unknown environment '$env'";
 
index cf6385e..551791f 100755 (executable)
@@ -14,7 +14,86 @@ my $environments = {
     pvelogo => 0, # ignore
 };
 
-my $fileinfo = {};
+my $fileinfo = {
+    outfile => {
+       default => {
+           "pve-admin-guide.adoc" => "pve-admin-guide.html",
+           "datacenter.cfg.adoc" => "datacenter.cfg.5.html",
+           "ha-manager.adoc" => "chapter-ha-manager.html",
+           "pct.adoc" => "chapter-pct.html",
+           "pve-bibliography.adoc" => "chapter-pve-bibliography.html",
+           "pve-firewall.adoc" => "chapter-pve-firewall.html",
+           "pve-installation.adoc" => "chapter-pve-installation.html",
+           "pvecm.adoc" => "chapter-pvecm.html",
+           "pvesm.adoc" => "chapter-pvesm.html",
+           "pveum.adoc" => "chapter-pveum.html",
+           "qm.adoc" => "chapter-qm.html",
+           "sysadmin.adoc" => "chapter-sysadmin.html",
+           "vzdump.adoc" => "chapter-vzdump.html",
+           "pmxcfs.adoc" => "chapter-pmxcfs.html",
+           "pve-faq.adoc" => "chapter-pve-faq.html",
+       },
+       manvolnum => {
+           "ha-manager.adoc" => "ha-manager.1",
+           "pct.adoc" => "pct.1",
+           "pveam.adoc" => "pveam.1",
+           "pveceph.adoc" => "pveceph.1",
+           "pvecm.adoc" => "pvecm.1",
+           "pveperf.adoc" => "pveperf.1",
+           "pvesm.adoc" => "pvesm.1",
+           "pvesubscription.adoc" => "pvesubscription.1",
+           "pveum.adoc" => "pveum.1",
+           "qm.adoc" => "qm.1",
+           "qmrestore.adoc" => "qmrestore.1",
+           "vzdump.adoc" => "vzdump.1",
+           "datacenter.cfg.adoc" => "datacenter.cfg.5",
+           "pct.conf.adoc" => "pct.conf.5",
+           "qm.conf.adoc" => "qm.conf.5",
+           "pmxcfs.adoc" => "pmxcfs.8",
+           "pvedaemon.adoc" => "pvedaemon.8",
+           "pve-firewall.adoc" => "pve-firewall.8",
+           "pve-ha-crm.adoc" => "pve-ha-crm.8",
+           "pve-ha-lrm.adoc" => "pve-ha-lrm.8",
+           "pveproxy.adoc" => "pveproxy.8",
+           "pvestatd.adoc" => "pvestatd.8",
+           "spiceproxy.adoc" => "spiceproxy.8",
+       },
+       wiki => {
+           "pve-usbstick.adoc" => "pve-usbstick-plain.html",
+           "getting-help.adoc" => "getting-help-plain.html",
+           "pve-system-requirements.adoc" => "pve-system-requirements-plain.html",
+           "pve-network.adoc" => "pve-network-plain.html",
+           "pve-package-repos.adoc" => "pve-package-repos-plain.html",
+           "system-software-updates.adoc" => "system-software-updates-plain.html",
+           "pve-disk-health-monitoring.adoc" => "pve-disk-health-monitoring-plain.html",
+           "local-lvm.adoc" => "local-lvm-plain.html",
+           "local-zfs.adoc" => "local-zfs-plain.html",
+           "system-timesync.adoc" => "system-timesync-plain.html",
+           "pve-installation.adoc" => "pve-installation-plain.html",
+           "sysadmin.adoc" => "sysadmin-plain.html",
+           "pvecm.adoc" => "pvecm-plain.html",
+           "pmxcfs.adoc" => "pmxcfs-plain.html",
+           "pvesm.adoc" => "pvesm-plain.html",
+           "qm.adoc" => "qm-plain.html",
+           "pve-firewall.adoc" => "pve-firewall-plain.html",
+           "pveum.adoc" => "pveum-plain.html",
+           "pct.adoc" => "pct-plain.html",
+           "ha-manager.adoc" => "ha-manager-plain.html",
+           "vzdump.adoc" => "vzdump-plain.html",
+           "pve-faq.adoc" => "pve-faq-plain.html",
+           "pve-bibliography.adoc" => "pve-bibliography-plain.html",
+           "pve-storage-dir.adoc" => "pve-storage-dir-plain.html",
+           "pve-storage-glusterfs.adoc" => "pve-storage-glusterfs-plain.html",
+           "pve-storage-iscsi.adoc" => "pve-storage-iscsi-plain.html",
+           "pve-storage-iscsidirect.adoc" => "pve-storage-iscsidirect-plain.html",
+           "pve-storage-lvm.adoc" => "pve-storage-lvm-plain.html",
+           "pve-storage-lvmthin.adoc" => "pve-storage-lvmthin-plain.html",
+           "pve-storage-nfs.adoc" => "pve-storage-nfs-plain.html",
+           "pve-storage-rbd.adoc" => "pve-storage-rbd-plain.html",
+           "pve-storage-zfspool.adoc" => "pve-storage-zfspool-plain.html",
+       },
+    },
+};
 
 my $start_env = [];
 foreach my $e (keys %$environments) {
@@ -241,8 +320,9 @@ sub resolve_link_target {
     while ($repeat) {
        $repeat = 0;
        foreach my $fn (keys %$include_hash) {
-           next if $fn eq 'pve-admin-guide.adoc';
            if ($include_hash->{$fn}->{$filename}) {
+               next if ($fn eq 'pve-admin-guide.adoc') &&
+                   $fileinfo->{outfile}->{$env}->{$filename};
                $filename = $fn;
                $repeat = 1;
                last;
@@ -264,16 +344,13 @@ foreach my $e (@$start_env) {
            die "found not title for '$fn' in env '$e'" if !$title;
            $fileinfo->{blockid_target}->{$e}->{$blockid} = "link:/wiki/$title#$blockid";
        } elsif ($e eq 'default') {
-           my $realfn = $fn;
-           $realfn =~ s/\.adoc//;
-           if (($realfn eq 'datacenter.cfg') || ($realfn eq 'qm.conf') || ($realfn eq 'pct.conf')) {
-               $realfn .= ".5";
-           } else {
-               $realfn = "chapter-$realfn";
-           }
-           $realfn .= ".html";
+           my $realfn = $fileinfo->{outfile}->{$e}->{$fn} ||
+               die "no output file mapping for '$fn'\n";
            $fileinfo->{blockid_target}->{$e}->{$blockid} = "link:/pve-docs/$realfn#$blockid";
-       } else {
+       } elsif ($e eq 'manvolnum') {
+           # we do not produce manpages for all content
+           # my $realfn = $fileinfo->{outfile}->{$e}->{$fn} ||
+           # warn "no output file mapping for '$fn'\n";
            $fileinfo->{blockid_target}->{$e}->{$blockid} = $fn;
        }
     }