Selaa lähdekoodia

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
Ryan C. Gordon 2 viikkoa sitten
vanhempi
commit
5b688514c7
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      build-scripts/wikiheaders.pl

+ 1 - 1
build-scripts/wikiheaders.pl

@@ -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;