gen.pl: support ## for doing .IP in table-like lists

Warn on use of .RS/.IP/.RE

Closes #12667
This commit is contained in:
Daniel Stenberg 2024-01-09 10:20:48 +01:00
parent 0ad13e0618
commit a859e29a60
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 39 additions and 0 deletions

View File

@ -54,6 +54,19 @@ Text written within `*asterisks*` is shown using italics. Text within two
Text that is prefixed with a space is treated like an "example" and gets
output in monospace.
Within the body, describe a lite of items like this:
## item 1
description
## item 2
second description
The list is automatically terminated at end of file, or you can do it
explicitly with an empty "header":
##
## Header and footer
`page-header` is the file that is output before the generated options output

View File

@ -319,10 +319,36 @@ sub single {
}
}
my @desc;
my $tablemode = 0;
while(<F>) {
$line++;
if(/^## (.*)/) {
if(!$tablemode) {
push @desc, ".RS\n";
$tablemode = 1;
}
push @desc, ".IP \"\\fB$1\\fP\"\n";
next;
}
elsif(/^##/) {
if($tablemode) {
# end of table
push @desc, ".RE\n.IP\n";
$tablmode = 0;
}
next;
}
elsif(/^\.(IP|RS|RE)/) {
my ($cmd) = ($1);
print STDERR "$f:$line:1:ERROR: $cmd detected, use ##-style\n";
}
push @desc, $_;
}
close(F);
if($tablemode) {
# end of table
push @desc, ".RE\n.IP\n";
}
my $opt;
if(defined($short) && $long) {