]> 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 13e6ae088a438e9cb30f4632eff92faa6adb32b2..2f24f331d77a1fe7e690f4a517328da7e6878b92 100755 (executable)
@@ -14,27 +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",
-       },
-    },
-};
+my $fileinfo = {};
 
 my $start_env = [];
 foreach my $e (keys %$environments) {
@@ -127,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;
        }
     }
 
@@ -291,9 +274,24 @@ foreach my $e (@$start_env) {
        } elsif ($e eq 'manvolnum') {
            my $realfn = $fn;
            $realfn =~ s/\.adoc$//;
-           die "toplevel file '$fn' is marhes as manual page!" if !$mansection;
+           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;
        }
     }
 }