]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gen: make `\>` in input to render as plain '>' in output
authorDaniel Stenberg <daniel@haxx.se>
Fri, 23 Feb 2024 11:52:09 +0000 (12:52 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 23 Feb 2024 12:48:07 +0000 (13:48 +0100)
Reported-by: Gisle Vanem
Fixes #12977
Closes #12978

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

index 2f393e27e3b672a1bf6f77b25d705942b2ea61b5..fa206c43b804ebcddcc11e45343596d2122aeb22 100644 (file)
@@ -28,9 +28,9 @@ is specified with one or two dashes, there can be no colon or equals character
 between the option and its parameter.
 
 If the parameter contains whitespace or starts with a colon (:) or equals sign
-(=), it must be specified enclosed within double quotes ("). Within double
-quotes the following escape sequences are available: \\, \", \t, \n, \r and
-\v. A backslash preceding any other letter is ignored.
+(=), it must be specified enclosed within double quotes ("like this"). Within
+double quotes the following escape sequences are available: \\, \", \t, \n, \r
+and \v. A backslash preceding any other letter is ignored.
 
 If the first non-blank column of a config line is a '#' character, that line
 is treated as a comment.
index 9b3128444e7a7a103f3627358739f11d26803b8f..17beab5b8bbe68dcbbddf0a7ae713f94f7e9c849 100755 (executable)
@@ -262,25 +262,9 @@ sub render {
         $d =~ s/`%VERSION`/$version/g;
         $d =~ s/`%GLOBALS`/$globals/g;
 
-        # convert single backslahes to doubles
-        $d =~ s/\\/\\\\/g;
-
         # convert backticks to double quotes
         $d =~ s/\`/\"/g;
 
-        if(!$quote && $d =~ /--/) {
-            # scan for options in longest-names first order
-            for my $k (sort {length($b) <=> length($a)} keys %optlong) {
-                # --tlsv1 is complicated since --tlsv1.2 etc are also
-                # acceptable options!
-                if(($k eq "tlsv1") && ($d =~ /--tlsv1\.[0-9]\\f/)) {
-                    next;
-                }
-                my $l = manpageify($k);
-                $d =~ s/\-\-$k([^a-z0-9-])/$l$1/g;
-            }
-        }
-
         if($d =~ /\(Added in ([0-9.]+)\)/i) {
             my $ver = $1;
             if(too_old($ver)) {
@@ -300,7 +284,23 @@ sub render {
             }
         }
         # convert backslash-'<' or '> to just the second character
-        $d =~ s/\\([<<])/$1/g;
+        $d =~ s/\\([><])/$1/g;
+        # convert single backslash to double-backslash
+        $d =~ s/\\/\\\\/g;
+
+        if(!$quote && $d =~ /--/) {
+            # scan for options in longest-names first order
+            for my $k (sort {length($b) <=> length($a)} keys %optlong) {
+                # --tlsv1 is complicated since --tlsv1.2 etc are also
+                # acceptable options!
+                if(($k eq "tlsv1") && ($d =~ /--tlsv1\.[0-9]\\f/)) {
+                    next;
+                }
+                my $l = manpageify($k);
+                $d =~ s/--$k([^a-z0-9-])/$l$1/g;
+            }
+        }
+
         # quote minuses in the output
         $d =~ s/([^\\])-/$1\\-/g;
         # replace single quotes