]> git.proxmox.com Git - pve-docs.git/blobdiff - scan-adoc-refs
scan-adoc-refs: fix title change via attribute
[pve-docs.git] / scan-adoc-refs
index 03dc51cf59f668da803c738d3fbb09b8f58b3ea4..2f24f331d77a1fe7e690f4a517328da7e6878b92 100755 (executable)
@@ -14,52 +14,7 @@ my $environments = {
     pvelogo => 0, # ignore
 };
 
-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",
-       },
-    },
-};
+my $fileinfo = {};
 
 my $start_env = [];
 foreach my $e (keys %$environments) {
@@ -152,11 +107,14 @@ sub register_title {
            die "unable to change title (no doctype)"
                if !defined($fileinfo->{doctype}->{$env}->{$filename});
        }
+    } elsif (!defined($doctype)) {
+       # change title via :title: attribute
+       $fileinfo->{titles}->{$env}->{$filename} = $title;
+    }
 
-       if (defined($doctype) && ($env eq 'manvolnum') && ($doctype == 0)) {
-           if ($title =~ m/.*\(([1-8])\)\s*$/) {
-               $fileinfo->{mansection}->{$env}->{$filename} = $1;
-           }
+    if (defined($doctype) && ($env eq 'manvolnum') && ($doctype == 0)) {
+       if ($title =~ m/.*\(([1-8])\)\s*$/) {
+           $fileinfo->{mansection}->{$env}->{$filename} = $1;
        }
     }
 
@@ -311,7 +269,28 @@ foreach my $e (@$start_env) {
            if (defined($mansection) && ($mansection == 5)) {
                $realfn .= ".$mansection";
            }
-           my $realfn = "$realfn-plain.html";
+           $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;
        }
     }