From 804bca5e95aa655a5dd531ed167105b615da6f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Fri, 1 Mar 2024 14:41:25 +0100 Subject: [PATCH] Replace 10 or more consecutive spaces with 9 in word clue used in xAPI description (#90) --- src/scripts/h5p-crossword-table.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/h5p-crossword-table.js b/src/scripts/h5p-crossword-table.js index ef2716d..a93fba2 100644 --- a/src/scripts/h5p-crossword-table.js +++ b/src/scripts/h5p-crossword-table.js @@ -1035,7 +1035,8 @@ export default class CrosswordTable { getXAPIDescription() { return this.params.words .map((word) => { - const clue = `${word.clueId} ${this.params.l10n[word.orientation]}: ${word.clue}`; + // The below replaceAll makes sure we don't get any unwanted XAPI_PLACEHOLDERs in the description: + const clue = `${word.clueId} ${this.params.l10n[word.orientation]}: ${word.clue.replaceAll(/_{10,}/gi, '_________')}`; const placeholders = []; if (this.params.scoreWords) {