]> git.proxmox.com Git - pve-docs.git/blobdiff - scan-adoc-refs
mark toplevel docs
[pve-docs.git] / scan-adoc-refs
index 613f282c6b72aa0abdc8c3efd0a3c9032a53d35c..c3ac08f9b4c57623a98741588d6312f21829382f 100755 (executable)
@@ -14,12 +14,6 @@ my $environments = {
     pvelogo => 0, # ignore
 };
 
-my $resolve_skip_files = {
-    default => {},
-    wiki => { 'pve-admin-guide.adoc' => 1 },
-    manvolnum => {},
-};
-
 my $fileinfo = {};
 
 my $start_env = [];
@@ -135,10 +129,17 @@ sub scan_adoc_file {
            chomp $env_last_line->{$e};
        }
 
-       # fixme: also scan <<>>
-
-       while ($line =~ m/xref:([^\s\[\]]+)\[([^\]]*)\]/g) {
-           # print "$filename xref:$1 [$2]\n";
+       if ($line =~ m/^:(\S+?):\s*(.*\S)?\s*$/) {
+           my ($key, $value) = ($1, $2);
+           if ($key eq 'pve-toplevel') {
+               
+               foreach my $e (@{$env_stack->[-1]}) {
+                   my $title = $fileinfo->{titles}->{$e}->{$filename};
+                   die "not title for toplevel file '$filename' (env=$e)\n"
+                       if !defined($title);
+                   $fileinfo->{toplevel}->{$e}->{$filename} = 1;
+               }
+           }
        }
 
        if ($line =~ m/^\[\[(.*)\]\]\s*$/) {
@@ -176,7 +177,6 @@ sub resolve_link_target {
     while ($repeat) {
        $repeat = 0;
        foreach my $fn (keys %$include_hash) {
-           next if $resolve_skip_files->{$env}->{$fn};
            if ($include_hash->{$fn}->{$filename}) {
                $filename = $fn;
                $repeat = 1;