]> git.proxmox.com Git - pve-docs.git/blobdiff - asciidoc-pve.in
asciidoc.js: use mediawiki resource loader queue
[pve-docs.git] / asciidoc-pve.in
index 878fe51772ce82481fa2fbe465046def340e624b..8550bac19327bc52ef06c39f282ec7d9ac5534d9 100644 (file)
@@ -234,6 +234,12 @@ sub prepare_adoc_file {
            next;
        }
 
+       if ($line =~ m/xref:\S+?\[[^\]]*$/) {
+           die "possible xref spanning multiple lines in '$filename':\n(line $.): $line\n";
+       }
+       if ($line =~ m/<<((?!\>\>).)*$/) {
+           die "possible xref spanning multiple lines in '$filename':\n(line $.): $line\n";
+       }
        # fix xrefs
        $line =~ s/xref:([^\s\[\]]+)\[([^\]]*)\]/replace_xref(${target_env},$1,$2)/ge;
 
@@ -262,7 +268,7 @@ sub compile_asciidoc {
        die "too many arguments...\n";
 
     my $outfilemap = $fileinfo->{outfile}->{$env}->{$infile} ||
-       die "no output file mapping '$infile => $outfile' ($env)";
+       die "no output file mapping for '$infile' ($env)";
 
     if ($man_target eq 'html') {
        $outfilemap .= '.html';
@@ -270,8 +276,12 @@ sub compile_asciidoc {
        $outfilemap .= '-plain.html';
     }
 
-    die "wrong output file name '$outfile != $outfilemap' ($env)"
-       if $outfile ne $outfilemap;
+    if (defined($outfile)) {
+       die "wrong output file name '$outfile != $outfilemap' ($env)"
+           if $outfile ne $outfilemap;
+    } else {
+       $outfile = $outfilemap;
+    }
 
     defined($fileinfo->{titles}->{$env}) ||
        die "unknown environment '$env'";
@@ -378,8 +388,6 @@ sub compile_asciidoc {
        if (($env eq 'wiki') ||
            (($env eq 'manvolnum') && ($man_target eq 'wiki'))) {
 
-           push @$cmd, '-s';
-
            if (-f "./asciidoc/mediawiki.conf") {
                my $cwd = getcwd();
                push @$cmd, '-b', "$cwd/asciidoc/mediawiki";
@@ -563,6 +571,47 @@ if ($clicmd eq 'compile-wiki') {
 
     print "var pveOnlineHelpInfo = ${data_str};\n";
 
+} elsif ($clicmd eq 'chapter-table') {
+    
+    print '[width="100%",options="header"]' . "\n";
+    print "|====\n";
+    print "|Title|Link\n";
+    
+    my $filelist = $fileinfo->{outfile}->{default};
+    foreach my $sourcefile (sort keys %$filelist) {
+       my $target = $filelist->{$sourcefile};
+       next if $target eq 'pve-admin-guide.html';
+       my $title = $fileinfo->{titles}->{default}->{$sourcefile} ||
+           die "not title for '$sourcefile'";
+       print "|$title|link:$target\[\]\n";
+    }
+    
+    print "|====\n";
+
+} elsif ($clicmd =~ m/^man([158])page-table$/) {
+    
+    my $section = $1;
+    print '[width="100%",cols="5*d",options="header"]' . "\n";
+    print "|====\n";
+    print "|Name 3+|Title|Link\n";
+    
+    my $filelist = $fileinfo->{outfile}->{manvolnum};
+    foreach my $manpage (sort keys %$filelist) {
+       next if $section ne $fileinfo->{mansection}->{manvolnum}->{$manpage};
+       my $mantitle = $fileinfo->{titles}->{manvolnum}->{$manpage} ||
+           die "not manual title for '$manpage'";
+       my $title = $fileinfo->{titles}->{default}->{$manpage} ||
+           die "not title for '$manpage'";
+
+       # hack - remove command name prefix from titles
+       $title =~ s/^[a-z]+\s*-\s*//;
+       
+       my $target = $filelist->{$manpage};
+       print "|$mantitle 3+|$title|link:$target.html\[$target\]\n";
+    }  
+    
+    print "|====\n";
+
 } else {
 
     die "unknown command '$clicmd'\n";