Skip to content

Commit

Permalink
fix: remediate erroneous white space in game and ach shortcode render…
Browse files Browse the repository at this point in the history
…ing (#1544)
  • Loading branch information
wescopeland committed May 5, 2023
1 parent 597e0af commit 8360cff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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);

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

0 comments on commit 8360cff

Please sign in to comment.