wikiheaders: Fix links in manpage generation.
Some checks are pending
Build (All) / Create test plan (push) Waiting to run
Build (All) / level1 (push) Blocked by required conditions
Build (All) / level2 (push) Blocked by required conditions

Fixes #15665.

(cherry picked from commit 7134ed5c1c)
This commit is contained in:
Ryan C. Gordon 2026-06-18 13:42:44 -04:00
parent 1de0c4e0f0
commit 76db4ee3e7
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -396,6 +396,19 @@ sub wikify {
return $retval;
}
sub gen_manpage_url {
my $url = shift;
my $desc = shift;
# We have to unmangle some mangling we just did. :/
$url =~ s/\\\[char46\]/./g;
# can't have newlines in this.
$desc =~ s/\n/ /g;
return "\n.URL \"$url\" \"$desc\"\n";
}
my $dewikify_mode = 'md';
my $dewikify_manpage_code_indent = 1;
@ -459,7 +472,7 @@ sub dewikify_chunk {
}
# links
$str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]/\n.URL "$1" "$2"\n/g;
$str =~ s/\[(https?\:\/\/.*?)\s+(.*?)\]\s*/gen_manpage_url($1, $2)/ge;
# <code></code> is also popular. :/
$str =~ s/\s*\<code>(.*?)<\/code>\s*/\n.BR $1\n/gms;
@ -496,7 +509,7 @@ sub dewikify_chunk {
}
# links
$str =~ s/\[(.*?)]\((https?\:\/\/.*?)\)/\n.URL "$2" "$1"\n/g;
$str =~ s/\[([^\]]*?)]\((https?\:\/\/.*?)\)\s*/gen_manpage_url($2, $1)/ge;
# <code></code> is also popular. :/
$str =~ s/\s*(\S*?)\`([^\n]*?)\`(\S*)\s*/\n.BR "" "$1" "$2" "$3"\n/gms;