From 21fa84348c3b1666a9d24c9a3739e7577cee8208 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Wed, 25 Sep 2024 10:37:30 +0200 Subject: [PATCH] fix(tools): broken import (#56278) --- .../parser/plugins/add-quizzes.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/challenge-parser/parser/plugins/add-quizzes.js b/tools/challenge-parser/parser/plugins/add-quizzes.js index d67c8aa805a..c1e3b9e788a 100644 --- a/tools/challenge-parser/parser/plugins/add-quizzes.js +++ b/tools/challenge-parser/parser/plugins/add-quizzes.js @@ -1,5 +1,5 @@ const { root } = require('mdast-builder'); -const getAllBetween = require('./utils/between-headings'); +const getSection = require('./utils/get-section'); const mdastToHtml = require('./utils/mdast-to-html'); const { splitOnThematicBreak } = require('./utils/split-on-thematic-break'); @@ -7,7 +7,7 @@ const { splitOnThematicBreak } = require('./utils/split-on-thematic-break'); function plugin() { return transformer; function transformer(tree, file) { - const quizzesNodes = getAllBetween(tree, `--quizzes--`); + const quizzesNodes = getSection(tree, `--quizzes--`); if (quizzesNodes.length > 0) { const quizzes = []; @@ -30,7 +30,7 @@ function plugin() { quizTrees.forEach(allQuizNodes => { const quizTree = root(allQuizNodes); - const quizNodes = getAllBetween(quizTree, `--quiz--`); + const quizNodes = getSection(quizTree, `--quiz--`); const quizQuestions = []; const questionTrees = []; @@ -53,12 +53,9 @@ function plugin() { questionTrees.forEach(singleQuestionNodes => { const questionTree = root(singleQuestionNodes); - const questionNodes = getAllBetween(questionTree, '--question--'); - const distractorNodes = getAllBetween( - questionTree, - '--distractors--' - ); - const answerNodes = getAllBetween(questionTree, '--answer--'); + const questionNodes = getSection(questionTree, '--question--'); + const distractorNodes = getSection(questionTree, '--distractors--'); + const answerNodes = getSection(questionTree, '--answer--'); quizQuestions.push( getQuestion(questionNodes, distractorNodes, answerNodes)