]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
managen: fix superfluous leading blank line in quoted sections
authorDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 21:59:17 +0000 (23:59 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 22:21:22 +0000 (00:21 +0200)
When a markdown quoted section using 4-space indentation was converted
to nroff, managen previously caused a newline to appear after the
leading .nf. This fix makes sure that newline is inserted *before* .nf
as intended.

This is perhaps most notable in the HTML version of rendered manpages if
the quoted sections use different colors or similar.

Closes #14732

scripts/managen
tests/data/test1705

index d816f002f0c5086ad645e15fc21c4a5536c998a0..2a1c1d9f8e00fa37a95823e51dcde7375ead7709 100755 (executable)
@@ -374,7 +374,9 @@ sub render {
         elsif($d =~ /^    (.*)/) {
             my $word = $1;
             if(!$quote && $manpage) {
+                push @desc, "\n" if($blankline);
                 push @desc, ".nf\n";
+                $blankline = 0;
             }
             $quote = 1;
             $d = "$word\n";
index af2263da39aa9fa5a27693dc2c02ddaaec6ac565..21bc70e3071ba339fab871f049f10ad2e04a7d93 100644 (file)
@@ -222,8 +222,8 @@ sensitive data, including usernames, credentials or secret data content. Be
 aware and be careful when sharing trace logs with others.
 
 End with a quote
-.nf
 
+.nf
 hello
 .fi