mirror of
https://git.proxmox.com/git/pve-docs
synced 2025-08-05 19:37:51 +00:00
scan-adoc-refs: fix chapter links (/pve-docs/chapter-xxx.html)
This commit is contained in:
parent
a22a4a80ad
commit
5e625ed3ab
@ -156,7 +156,7 @@ sub scan_adoc_file {
|
|||||||
if ($line =~ m/^:(\S+?):\s*(.*\S)?\s*$/) {
|
if ($line =~ m/^:(\S+?):\s*(.*\S)?\s*$/) {
|
||||||
my ($key, $value) = ($1, $2);
|
my ($key, $value) = ($1, $2);
|
||||||
if ($key eq 'pve-toplevel') {
|
if ($key eq 'pve-toplevel') {
|
||||||
|
|
||||||
foreach my $e (@{$env_stack->[-1]}) {
|
foreach my $e (@{$env_stack->[-1]}) {
|
||||||
my $title = $fileinfo->{titles}->{$e}->{$filename};
|
my $title = $fileinfo->{titles}->{$e}->{$filename};
|
||||||
die "not title for toplevel file '$filename' (env=$e)\n"
|
die "not title for toplevel file '$filename' (env=$e)\n"
|
||||||
@ -205,6 +205,7 @@ sub resolve_link_target {
|
|||||||
while ($repeat) {
|
while ($repeat) {
|
||||||
$repeat = 0;
|
$repeat = 0;
|
||||||
foreach my $fn (keys %$include_hash) {
|
foreach my $fn (keys %$include_hash) {
|
||||||
|
next if $fn eq 'pve-admin-guide.adoc';
|
||||||
if ($include_hash->{$fn}->{$filename}) {
|
if ($include_hash->{$fn}->{$filename}) {
|
||||||
$filename = $fn;
|
$filename = $fn;
|
||||||
$repeat = 1;
|
$repeat = 1;
|
||||||
@ -226,6 +227,10 @@ foreach my $e (@$start_env) {
|
|||||||
$title =~ s/\s/_/g;
|
$title =~ s/\s/_/g;
|
||||||
die "found not title for '$fn' in env '$e'" if !$title;
|
die "found not title for '$fn' in env '$e'" if !$title;
|
||||||
$fileinfo->{blockid_target}->{$e}->{$blockid} = "link:/wiki/$title#$blockid";
|
$fileinfo->{blockid_target}->{$e}->{$blockid} = "link:/wiki/$title#$blockid";
|
||||||
|
} elsif ($e eq 'default') {
|
||||||
|
my $realfn = "chapter-$fn";
|
||||||
|
$realfn =~ s/\.adoc/.html/;
|
||||||
|
$fileinfo->{blockid_target}->{$e}->{$blockid} = "link:/pve-docs/$realfn#$blockid";
|
||||||
} else {
|
} else {
|
||||||
$fileinfo->{blockid_target}->{$e}->{$blockid} = $fn;
|
$fileinfo->{blockid_target}->{$e}->{$blockid} = $fn;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user