]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gen.pl: support ## for doing .IP in table-like lists
authorDaniel Stenberg <daniel@haxx.se>
Tue, 9 Jan 2024 09:20:48 +0000 (10:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 9 Jan 2024 15:00:16 +0000 (16:00 +0100)
Warn on use of .RS/.IP/.RE

Closes #12667

docs/cmdline-opts/MANPAGE.md
docs/cmdline-opts/gen.pl

index 6de32dab94dfb44635d8e3e6b180a183127dd3b7..4896f8513ef7e6e27b08f9ddab0de432954bd0db 100644 (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
index 16324550888cf2d876fc11e9d4738eda2dd25c2b..fbe0f546b882b187ba9670abd24a49e5ac79281d 100755 (executable)
@@ -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) {