dev: improvements to gen-list-unimplemented-cards-for-set.pl (#14308)

* Handle colons and ampersands in card names

* URL encode ampersands to prevent them being handled as GET parameters in card names
This commit is contained in:
Muz 2026-01-26 19:16:02 -06:00 committed by GitHub
parent 1208785d78
commit cc224c1bad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -82,7 +82,8 @@ sub cardSort {
sub toCamelCase {
my $string = $_[0];
$string =~ s/\b([\w']+)\b/ucfirst($1)/ge;
$string =~ s/[-,\s\'\.!@#*\(\)]//g;
$string =~ s/[-,\s\'\.!@#*:\(\)]//g;
$string =~ s/\&/And/g;
$string;
}
@ -116,6 +117,7 @@ foreach my $card (sort cardSort @setCards) {
my $currentFileName = "../Mage.Sets/src/mage/cards/" . lc(substr($className, 0, 1)) . "/" . $className . ".java";
my $cardNameForUrl = $cardName;
$cardNameForUrl =~ s/ //g;
$cardNameForUrl =~ s/\&/%26/g; # URL encode ampersands
my $cardEntry = "- [ ] In progress -- [$cardName](https://scryfall.com/search?q=!\"$cardNameForUrl\" e:$setAbbr)";
if(-e $currentFileName) {
@ -138,6 +140,7 @@ foreach my $cardName (sort keys %cardNames) {
my $urlCardName = $cardName;
$urlCardName =~ s/ //g;
$urlCardName =~ s/"/\\"/g; # Escape quotes
$urlCardName =~ s/\&/%26/g; # URL encode ampersands
push(@unimplementedNames, "!\"$urlCardName\"");
}
}
@ -158,4 +161,4 @@ close(OUTPUT);
print "Issue tracker generated: $outputFile\n";
print "Implemented cards: " . scalar(@implementedCards) . "\n";
print "Unimplemented cards: " . scalar(@unimplementedCards) . "\n";
print "Unimplemented cards: " . scalar(@unimplementedCards) . "\n";