Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remediate erroneous white space in game and ach shortcode rendering #1544

Merged
6 changes: 5 additions & 1 deletion app_legacy/Helpers/render/achievement.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ function renderAchievementTitle(?string $title, bool $tags = true): string
}
$title = str_replace('[m]', '', $title);

return "$title$missableTag";
// If we don't strip consecutive spaces, the
// browser doesn't collapse them in forum <pre> tags.
$title = preg_replace('/\s+/', ' ', $title);
Jamiras marked this conversation as resolved.
Show resolved Hide resolved

return trim("$title$missableTag");
}

function renderAchievementCard(int|string|array $achievement, ?string $context = null, ?string $iconUrl = null): string
Expand Down
2 changes: 1 addition & 1 deletion app_legacy/Helpers/render/game.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function renderGameTitle(?string $title = null, bool $tags = true): string
$updateHtml($html, $match, $tags ? " $span" : '');
}
$matches = [];
if (preg_match('/\[Subset - (.+)\]/', $title, $matches)) {
if (preg_match('/\s?\[Subset - (.+)\]/', $title, $matches)) {
$subset = $matches[1];
$span = "<span class='tag'>"
. "<span class='tag-label'>Subset</span>"
Expand Down