diff --git a/QuestionPaperPreview.js b/QuestionPaperPreview.js index d6162e8..7c6952a 100644 --- a/QuestionPaperPreview.js +++ b/QuestionPaperPreview.js @@ -72,8 +72,9 @@ function CheakQnType(question, questionIndex, depth,nested) { } } -let count =0 +var count =0 var count1 =0 +var romanNumerals = ["", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x"]; function processQuestion(question, questionIndex, depth,nested) { // console.log('question Data') // console.log(question); @@ -88,16 +89,21 @@ function processQuestion(question, questionIndex, depth,nested) { const questionIndentation = " ".repeat(depth + 1); console.log(questionIndentation) if (nested == 1) {// this adds the inside the questionGroup - count1++ - questionPaper += `
${questionIndentation}${count}.${count1}) ${convertToLatex(questionText, mathstatus)}${questionIndentation}

Marks :${questionMark}

${convertToLatex(questionDescription, mathstatus)}
`; + count1++; + var romanNumeral=romanNumerals[count1]; + questionPaper += `
${questionIndentation}${romanNumeral}) ${convertToLatex(questionText, mathstatus)}${questionIndentation}

Marks :${questionMark}

${convertToLatex(questionDescription, mathstatus)}
`; } else { count++ questionPaper += `
${questionIndentation}${count}) ${convertToLatex(questionText, mathstatus)}${questionIndentation}

Marks :${questionMark}

${convertToLatex(questionDescription, mathstatus)}
`; } + console.log(questionPaper); // If it's an MCQ question, add choices + + // If it's an MCquestionText + if (question.question_type === "group") { const answers = question.answers; const alphabetOptions = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Define the alphabet options @@ -144,7 +150,7 @@ function GroupQuestion(question, questionIndex, depth) { // Function to recursively convert JSON to a formatted question paper function convertJSONToQuestionPaper(data, depth = 0, sectionIndex = 1, questionIndex = 1) { const sections = data.sections; - console.log(sections); + // console.log(sections); // Extract the heading information const questionPaperTitle = data.question_paper_title; const questionPaperDescription = data.question_paper_description; @@ -170,7 +176,7 @@ function convertJSONToQuestionPaper(data, depth = 0, sectionIndex = 1, questionI const indentation = " ".repeat(depth); // questionPaper += `${indentation}${sectionTitle}${sectionAttempt}${sectionMark}${indentation}${sectionDescription}`; - questionPaper += `${indentation}${modifiedSectionTitle}${sectionMark}${sectionAttempt}${indentation}${sectionDescription}`; + questionPaper += `${indentation}
${modifiedSectionTitle}${sectionMark}${sectionAttempt}${indentation}${sectionDescription}`; // Process each question in the section @@ -191,5 +197,4 @@ const formattedQuestionPaper = convertJSONToQuestionPaper(jsonData, 0, 1, 1); const questionPaperElement = document.getElementById("questionPaper"); console.log(questionPaperElement); questionPaperElement.innerHTML = formattedQuestionPaper; // Use innerHTML here - } \ No newline at end of file diff --git a/QuestionPreview.html b/QuestionPreview.html index 147717a..2ea7316 100644 --- a/QuestionPreview.html +++ b/QuestionPreview.html @@ -49,22 +49,33 @@