diff --git a/QuestionPaperPreview.js b/QuestionPaperPreview.js
index 31cfc9e..6ab282b 100644
--- a/QuestionPaperPreview.js
+++ b/QuestionPaperPreview.js
@@ -85,17 +85,18 @@ function QuestionPaperPreview(jsonData){
const modifiedSectionTitle = sectionTitle.replaceAll('
', '
');//add the id for Section Title
var sectionAttempt = `
Attempt Any : ${section.section_attempt_any}
`;
var sectionMark = `Marks: ${section.section_marks}
`;
- const sectionDescription = section.section_description;
+ const sectionDescriptio = section.section_description;
+ const sectionDescription = sectionDescriptio.replaceAll('', '
');
// const questions = section.questions;
// Add appropriate indentation for nested sections
const indentation = " ".repeat(depth);
- if (section.section_attempt_any === '') {
- sectionAttempt = sectionAttempt.replace('
', '
')
- }
+ // if (section.section_attempt_any === '') {
+ // sectionAttempt = sectionAttempt.replace('
', '
')
+ // }
- if (section.section_marks === '') {
- sectionMark = sectionMark.replace('
', '
')
- }
+ // if (section.section_marks === '') {
+ // sectionMark = sectionMark.replace('
', '
')
+ // }
questionPaper += `${indentation}
${modifiedSectionTitle}${sectionMark}${sectionAttempt}${indentation}${sectionDescription}`;
displayQuestions(section)
@@ -106,48 +107,56 @@ function QuestionPaperPreview(jsonData){
}
var depth2 =0
var description_align =25;
- function displayQuestions(data, parentSno =''){
+ function displayQuestions(data,parentSno =''){
var questionIndentation = " ".repeat(depth2);
var dataa =data.questions;
dataa.forEach((question, index) =>{
var currentSno = parentSno + (index + 1) + '.';
+ var temp_sno= currentSno.slice(0,-1)
var currentSno_length =currentSno.length-(currentSno.length/2)
if (currentSno_length == 1) {
- description_align =25
+ description_align =17
} else if (currentSno_length == 2) {
- description_align =50
+ description_align =33
}else if(currentSno_length == 3){
- description_align =65
- }else {
- description_align =80
+ description_align =48
+ }else if(currentSno_length == 4) {
+ description_align =64
+ }
+ else if(currentSno_length == 5) {
+ description_align =78
}
if (question.group_title) {
const questionGroupSetP = `${question.group_title}`;
- const questionGroupmodify =questionGroupSetP.replaceAll('', '
')
- var questionGroupAttempt = `
Attempt Any : ${question.group_attempt_any}
`
+ const questionGroupmodify =questionGroupSetP.replaceAll('', `
`)
+ var questionGroupAttempt = `
Attempt Any : ${question.group_attempt_any}
`
var questionGroupMark = `Marks : ${question.group_marks}
`
- if (question.group_attempt_any === '') {
- questionGroupAttempt = questionGroupAttempt.replace('', '
')
- }
-
- if (question.group_marks === '') {
- questionGroupMark = questionGroupMark.replace('
', '
')
- }
+ const questionGroupDescriptio = question.group_description;
+ const questionGroupDescription = questionGroupDescriptio.replaceAll('
', '
')
- questionPaper += `
${currentSno}) ${questionGroupmodify}${questionGroupMark}${questionGroupAttempt}
`
+ // if (question.group_attempt_any === '') {
+ // questionGroupAttempt = questionGroupAttempt.replace('', '
')
+ // }
+
+ // if (question.group_marks === '') {
+ // questionGroupMark = questionGroupMark.replace('
', '
')
+ // }
+
+ questionPaper += `
${temp_sno})${questionGroupmodify}
`
- // questionPaper += ``;
- // questionPaper += ``;
+ questionPaper += `${questionGroupAttempt}${questionGroupMark}
`;
+ // questionPaper += `${questionGroupAttempt}
`;
- questionPaper += `${question.group_description}
`;
+ questionPaper += `${questionGroupDescription}
`;
depth2++
} else if (question.question) {
const questionTex = question.question;
- const questionText = questionTex.replaceAll('', '
');
- console.log(questionText);
- const questionDescription = question.question_description;
+ const questionText = questionTex.replaceAll('
', `
`);
+ // console.log(questionText);
+ const questionDescriptio = question.question_description;
+ const questionDescription = questionDescriptio.replaceAll('
', '
')
const mathstatus = question.is_math_enabled;
var questionMark = `
Marks :${question.marks}
`;
// console.log(questionMark);
@@ -156,22 +165,41 @@ function QuestionPaperPreview(jsonData){
questionMark = questionMark.replace('', '
')
}
- questionPaper += `
${currentSno}) ${convertToLatex(questionText, mathstatus)}
${questionMark}${convertToLatex(questionDescription, mathstatus)}
`;
+
+
+ questionPaper += `${temp_sno})${convertToLatex(questionText, mathstatus)}
${questionMark}${convertToLatex(questionDescription, mathstatus)}
`;
if (question.question_type === "group") {
- const answers = question.answers;
+ var answers = question.answers;
+ var choisealgin =25
+ var currentSno_length1 =currentSno.length-(currentSno.length/2)
+ if (currentSno_length1 == 1) {
+ choisealgin =26
+ } else if (currentSno_length1 == 2) {
+ choisealgin =40
+ }else if(currentSno_length1 == 3){
+ choisealgin =55
+ }else if(currentSno_length1 == 4) {
+ choisealgin =70
+ }
+ else if(currentSno_length1 == 5) {
+ choisealgin =84
+ }
+
const alphabetOptions = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // Define the alphabet options
-
for (let i = 0; i < answers.length; i++) { // change the i +=2 aadhavan
const optionA = alphabetOptions[i];
// const optionB = alphabetOptions[i + 1];
-
- const answerA = answers[i] ? `${optionA}. ${convertToLatex(answers[i].choice_name, mathstatus)}` : '';
+
+ var math = answers[i].is_math_enabled;
+ // var choice_name_set =answers[i].choice_name.replace('','
')
+
+ const answerA = answers[i] ? `${optionA}. ${convertToLatex(answers[i].choice_name, math)}` : '';
// const answerB = answers[i + 1] ? `${optionB}. ${convertToLatex(answers[i + 1].choice_name, mathstatus)}` : '';
if (multipleAnswer == 'false') {
- questionPaper += `
${answerA.padEnd(10)}
`;
+ questionPaper += ` ${answerA.padEnd(10)}
`;
}else{
- questionPaper += ` ${answerA.padEnd(10)}
`;
+ questionPaper += ` ${answerA.padEnd(10)}
`;
}
}
}
diff --git a/QuestionPreview.html b/QuestionPreview.html
index f63c408..5ced434 100644
--- a/QuestionPreview.html
+++ b/QuestionPreview.html
@@ -49,7 +49,7 @@
@@ -369,7 +412,22 @@
+