Skip to content

Commit

Permalink
fix replacement for 2+ variables
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Feb 29, 2024
1 parent 217f86c commit 68f84a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/components/hints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getHintText(hint: GameHint): string {
if (hint.rawText) {
// Replace the variable names used in the hint with the ones used by the player
// variable names are marked like `«{g}»` inside the text.
return hint.rawText.replace(/«\{(.*?)\}»/, ((_, v) =>
return hint.rawText.replaceAll(/«\{(.*?)\}»/g, ((_, v) =>
// `hint.varNames` contains tuples `[oldName, newName]`
(hint.varNames.find(x => x[0] == v))[1]))
} else {
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"downlevelIteration": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"lib": [
"ES2021.String"
]
},
"exclude": ["server", "relay"]
}

0 comments on commit 68f84a3

Please sign in to comment.