* man/help2man: The BEL terminator format was already supported.
Add support for ESC + backslash terminator. Also split out
and document the regular expression.
# Convert OSC 8 hyperlinks to markers placed after leading dashes
# This preserves help2man's option detection (which looks for /^ +[-+]/)
- $value =~ s/\x1b\]8;;([^\x07]*)\x07(--?)(.*?)\x1b\]8;;\x07/{
+ # Support both BEL (\x07) and ST (\x1b\) terminators
+ $value =~ s/
+ \x1b\]8;;([^\x07\x1b]*)(?:\x07|\x1b\\) # opening OSC 8 with URL
+ (--?)(.*?) # dashes and link text
+ \x1b\]8;;(?:\x07|\x1b\\) # closing OSC 8
+ /{
my $idx = scalar @hyperlink_urls;
push @hyperlink_urls, $1;
"$2\x01$idx\x02$3\x03";
- }/gse;
+ }/gsex;
$value;
}