wikiheaders: Don't autolink things that are already linked.

This is a dirty hack, but it currently works for our purposes. We just refuse
to link an eligible string (like, say...`SDL_shadercross`), if there's a '['
character right before it.

This WILL NOT WORK if the string is in the middle of a link! For example, if
you had `[please refer to SDL_shadercross](https://example.com/)`, this will
still fail in the usual ways, but we're not building out a robust parser here
at the moment, and this catches the most common problem.

Fixes #13160.
Fixes https://github.com/libsdl-org/sdlwiki/issues/752
Closes https://github.com/libsdl-org/sdlwiki/pull/725
This commit is contained in:
Ryan C. Gordon
2025-08-26 14:43:59 -04:00
parent 6516f7a9e8
commit 5b688514c7

View File

@@ -343,7 +343,7 @@ sub wikify_chunk {
# Convert obvious API things to wikilinks.
if (defined $apiprefixregex) {
$str =~ s/(\A|[^\/a-zA-Z0-9_])($apiprefixregex[a-zA-Z0-9_]+)/$1\[$2\]\($2\)/gms;
$str =~ s/(\A|[^\/a-zA-Z0-9_\[])($apiprefixregex[a-zA-Z0-9_]+)/$1\[$2\]\($2\)/gms;
}
$str = $codedstr . $str;