From: Daniel Stenberg Date: Tue, 9 Jan 2024 09:20:48 +0000 (+0100) Subject: gen.pl: support ## for doing .IP in table-like lists X-Git-Tag: curl-8_6_0~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a859e29a60cf00129cc3484b1dd3423102958a5a;p=thirdparty%2Fcurl.git gen.pl: support ## for doing .IP in table-like lists Warn on use of .RS/.IP/.RE Closes #12667 --- diff --git a/docs/cmdline-opts/MANPAGE.md b/docs/cmdline-opts/MANPAGE.md index 6de32dab94..4896f8513e 100644 --- a/docs/cmdline-opts/MANPAGE.md +++ b/docs/cmdline-opts/MANPAGE.md @@ -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 diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index 1632455088..fbe0f546b8 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -319,10 +319,36 @@ sub single { } } my @desc; + my $tablemode = 0; while() { + $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) {