curldown: fixups

- make DEFAULT sections less repetitive

- make historic mentions use HISTORY

- generate the protocols section on `# %PROTOCOLS%` instead of guessing
  where to put it

- generate the availability section on `# %AVAILABILITY%` instead of
  guessing where to put it

- make the protocols section more verbose

Closes #14227
This commit is contained in:
Daniel Stenberg 2024-07-19 01:06:06 +02:00
parent 126cf7eccb
commit 5a488251f7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
488 changed files with 2095 additions and 119 deletions

View file

@ -103,15 +103,25 @@ sub outprotocols {
push @o, ".SH PROTOCOLS\n";
if($p[0] eq "TLS") {
push @o, "All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.";
push @o, "This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.";
}
else {
my @s = sort @p;
push @o, "This functionality affects ";
for my $e (sort @s) {
push @o, sprintf "%s$e",
$comma ? (($e eq $s[-1]) ? " and " : ", "): "";
push @o, sprintf "%s%s",
$comma ? (($e eq $s[-1]) ? " and " : ", "): "",
lc($e);
$comma = 1;
}
if($#s == 0) {
if($s[0] eq "All") {
push @o, " supported protocols";
}
else {
push @o, " only";
}
}
}
push @o, "\n";
return @o;
@ -447,20 +457,24 @@ sub single {
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
elsif($word eq "%PROTOCOLS%") {
# insert the generated PROTOCOLS section
push @desc, outprotocols(@proto);
if($proto[0] eq "TLS") {
push @desc, outtls(@tls);
}
$header = 1;
next;
}
elsif($word eq "RETURN VALUE") {
elsif($word eq "%AVAILABILITY%") {
if($addedin ne "n/a") {
# insert the generated AVAILABILITY section before RETURN VALUE
# insert the generated AVAILABILITY section
push @desc, ".SH AVAILABILITY\n";
push @desc, "Added in curl $addedin\n";
}
$header = 1;
next;
}
push @desc, ".SH $word\n";
$header = 1;