mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(tools): broken import (#56278)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user