From 8c4070625ed3cdd7d0922dd444f010e0da49446e Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Fri, 20 Oct 2023 10:22:11 +0530 Subject: [PATCH] PREVIEW_CHANGE : AADHAVAN --- QuestionPaperPreview.js | 16 +++++++------- QuestionPreview.html | 30 ++++++++++++++++++++------- addform.html | 21 +++++++++++++++++-- savexml.js | 9 ++++---- xml2json_for_Questionpaper_preview.js | 5 +++-- 5 files changed, 57 insertions(+), 24 deletions(-) diff --git a/QuestionPaperPreview.js b/QuestionPaperPreview.js index ed654f5..eff4bdc 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) { const questionTex = question.question; const questionText = questionTex.replace('

', '

'); @@ -84,14 +85,14 @@ function processQuestion(question, questionIndex, depth,nested) { // Add appropriate indentation for nested questions const questionIndentation = " ".repeat(depth + 1); 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)}
`; } - - // 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 @@ -138,7 +139,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; @@ -164,7 +165,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 @@ -184,5 +185,4 @@ function convertJSONToQuestionPaper(data, depth = 0, sectionIndex = 1, questionI const formattedQuestionPaper = convertJSONToQuestionPaper(jsonData, 0, 1, 1); const questionPaperElement = document.getElementById("questionPaper"); questionPaperElement.innerHTML = formattedQuestionPaper; // Use innerHTML here - } \ No newline at end of file diff --git a/QuestionPreview.html b/QuestionPreview.html index 8e3ac38..40f9230 100644 --- a/QuestionPreview.html +++ b/QuestionPreview.html @@ -49,22 +49,33 @@