From 1244e9775f664707bc54d5f977a9b29a34615784 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 2 Jun 2020 18:52:44 +0200 Subject: [PATCH] fix(client): allow numbers as answers (#38992) Handles yaml floats. --- tools/challenge-md-parser/tests-to-data.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/challenge-md-parser/tests-to-data.js b/tools/challenge-md-parser/tests-to-data.js index f550bd2499..a22072c2c4 100644 --- a/tools/challenge-md-parser/tests-to-data.js +++ b/tools/challenge-md-parser/tests-to-data.js @@ -27,8 +27,10 @@ function plugin() { if (lang === 'yml') { const tests = YAML.load(value); if (tests.question) { + // mdToHTML can not parse numbers. If an answer is a number + // (i.e. 5, not '5') it has to be converted. tests.question.answers = tests.question.answers.map(answer => - mdToHTML(answer) + mdToHTML(answer.toString()) ); tests.question.text = mdToHTML(tests.question.text); }