mirror of
git://git.proxmox.com/git/pve-docs.git
synced 2025-01-06 13:17:48 +03:00
move code from gen-index-includes.pl into asciidoc-pve.in
This commit is contained in:
parent
38ae8db3a1
commit
fd02ab9033
16
Makefile
16
Makefile
@ -87,20 +87,20 @@ README.html: README.adoc
|
||||
index: index.html
|
||||
$(BROWSER) index.html &
|
||||
|
||||
chapter-index-table.adoc: gen-index-includes.pl
|
||||
./gen-index-includes.pl chapter-table >$@.tmp
|
||||
chapter-index-table.adoc: asciidoc-pve
|
||||
./asciidoc-pve chapter-table >$@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
man1-index-table.adoc: gen-index-includes.pl
|
||||
./gen-index-includes.pl man1page-table >$@.tmp
|
||||
man1-index-table.adoc: asciidoc-pve
|
||||
./asciidoc-pve man1page-table >$@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
man5-index-table.adoc: gen-index-includes.pl
|
||||
./gen-index-includes.pl man5page-table >$@.tmp
|
||||
man5-index-table.adoc: asciidoc-pve
|
||||
./asciidoc-pve man5page-table >$@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
man8-index-table.adoc: link-refs.json gen-index-includes.pl
|
||||
./gen-index-includes.pl man8page-table >$@.tmp
|
||||
man8-index-table.adoc: asciidoc-pve
|
||||
./asciidoc-pve man8page-table >$@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
index.html: index.adoc ${API_VIEWER_SOURCES} ${INDEX_INCLUDES}
|
||||
|
@ -563,6 +563,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";
|
||||
|
@ -1,60 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use JSON;
|
||||
use IO::File;
|
||||
use Data::Dumper;
|
||||
|
||||
my $fh = IO::File->new("link-refs.json", "r") ||
|
||||
die "unable to open 'link-refs.json' - $!\n";
|
||||
|
||||
my $data_str = "";
|
||||
while (<$fh>) { $data_str .= $_; }
|
||||
my $fileinfo = decode_json($data_str);
|
||||
|
||||
my $cmd = shift;
|
||||
|
||||
die "missing command name" if !$cmd;
|
||||
die "too many arguments" if scalar(@ARGV);
|
||||
|
||||
|
||||
#print Dumper($fileinfo);
|
||||
|
||||
if ($cmd 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 ($cmd =~ 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\n";
|
||||
}
|
||||
print "|====\n";
|
||||
} else {
|
||||
die "unknown command '$cmd'\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user