curldown: make 'added-in:' a mandatory header field

- generate AVAILABILITY manpage sections automatically - for consistent
  wording

- allows us to double-check against other documumentation (symbols-in-versions
  etc)

- enables proper automation/scripting based on this data

- lots of them were wrong or missing in the manpages

- several of them repeated (sometimes mismatching) backend support info

Add test 1488 to verify "added-in" version numbers against
symbols-in-versions.

Closes #14217
This commit is contained in:
Daniel Stenberg 2024-07-18 00:51:50 +02:00
parent d8696dc8c0
commit 8c1d9378ac
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
508 changed files with 875 additions and 1883 deletions

View file

@ -197,6 +197,7 @@ sub single {
my $tlslist;
my $section;
my $source;
my $addedin;
my $spdx;
my $start = 0;
my $title;
@ -247,6 +248,14 @@ sub single {
elsif(/^TLS-backend:/i) {
$list = 3; # 3 for TLS backend
}
elsif(/^Added-in: *(.*)/i) {
$addedin=$1;
if(($addedin !~ /^[0-9.]+[0-9]\z/) &&
($addedin ne "n/a")) {
print STDERR "$f:$line:1:ERROR: invalid version number in Added-in line: $addedin\n";
return 2;
}
}
elsif(/^ +- (.*)/i) {
# the only lists we support are see-also and protocol
if($list == 1) {
@ -274,11 +283,19 @@ sub single {
elsif(/^---/) {
# end of the header section
if(!$title) {
print STDERR "ERROR: no 'Title:' in $f\n";
print STDERR "$f:$line:1:ERROR: no 'Title:' in $f\n";
return 1;
}
if(!$section) {
print STDERR "ERROR: no 'Section:' in $f\n";
print STDERR "$f:$line:1:ERROR: no 'Section:' in $f\n";
return 2;
}
if(!$source) {
print STDERR "$f:$line:1:ERROR: no 'Source:' in $f\n";
return 2;
}
if(!$addedin) {
print STDERR "$f:$line:1:ERROR: no 'Added-in:' in $f\n";
return 2;
}
if(!$seealso[0]) {
@ -427,6 +444,9 @@ sub single {
if($word eq "PROTOCOLS") {
print STDERR "$f:$line:1:WARN: PROTOCOLS section in source file\n";
}
elsif($word eq "AVAILABILITY") {
print STDERR "$f:$line:1:WARN: AVAILABILITY section in source file\n";
}
elsif($word eq "EXAMPLE") {
# insert the generated PROTOCOLS section before EXAMPLE
push @desc, outprotocols(@proto);
@ -435,6 +455,13 @@ sub single {
push @desc, outtls(@tls);
}
}
elsif($word eq "RETURN VALUE") {
if($addedin ne "n/a") {
# insert the generated AVAILABILITY section before RETURN VALUE
push @desc, ".SH AVAILABILITY\n";
push @desc, "Added in curl $addedin\n";
}
}
push @desc, ".SH $word\n";
$header = 1;
}