Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,22 +67,23 @@ def get_all_questions(unit_num,conceptual_list,problem_list,conceptual_url,probl
|
|
| 67 |
|
| 68 |
from jinja2 import Template
|
| 69 |
|
| 70 |
-
def generate_html(chapter_num, conceptual_input, problem_input,path):
|
| 71 |
conceptual_list = list(map(int, conceptual_input.split(",")) if conceptual_input else [])
|
| 72 |
problem_list = list(map(int, problem_input.split(",")) if problem_input else [])
|
| 73 |
|
| 74 |
-
conceptual_url=phy2_conceptual_link.format(int(chapter_num))
|
| 75 |
-
problem_url=phy2_problem_link.format(int(chapter_num))
|
| 76 |
|
| 77 |
-
questions=get_all_questions(int(chapter_num),conceptual_list,problem_list,conceptual_url,problem_url)
|
| 78 |
template_str = '''
|
| 79 |
<!DOCTYPE html>
|
| 80 |
<html>
|
| 81 |
<head>
|
| 82 |
<title>Chapter {{ chapter_number }} Questions</title>
|
| 83 |
-
<
|
| 84 |
-
src="https://
|
| 85 |
-
<
|
|
|
|
| 86 |
<style>
|
| 87 |
body {
|
| 88 |
font-family: 'Calibri', sans-serif;
|
|
@@ -91,14 +92,14 @@ def generate_html(chapter_num, conceptual_input, problem_input,path):
|
|
| 91 |
.page-break {
|
| 92 |
page-break-after: always;
|
| 93 |
}
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
</style>
|
| 98 |
</head>
|
| 99 |
<body>
|
| 100 |
<div>
|
| 101 |
-
<h2>Chapter: {{ chapter_number }}</
|
| 102 |
{% if conceptual_problem_list %}
|
| 103 |
<h2>Conceptual Problems: {{ conceptual_problem_list|join(", ") }}</h2>
|
| 104 |
<p><a href="{{ conceptual_url }}">{{ conceptual_url }}</a></p>
|
|
@@ -111,7 +112,7 @@ def generate_html(chapter_num, conceptual_input, problem_input,path):
|
|
| 111 |
<div class="page-break"></div>
|
| 112 |
|
| 113 |
{% for question in questions %}
|
| 114 |
-
<div>{{ question|safe }}</div>
|
| 115 |
<div class="page-break"></div>
|
| 116 |
{% endfor %}
|
| 117 |
</body>
|
|
|
|
| 67 |
|
| 68 |
from jinja2 import Template
|
| 69 |
|
| 70 |
+
def generate_html(chapter_num, conceptual_input, problem_input, path):
|
| 71 |
conceptual_list = list(map(int, conceptual_input.split(",")) if conceptual_input else [])
|
| 72 |
problem_list = list(map(int, problem_input.split(",")) if problem_input else [])
|
| 73 |
|
| 74 |
+
conceptual_url = phy2_conceptual_link.format(int(chapter_num))
|
| 75 |
+
problem_url = phy2_problem_link.format(int(chapter_num))
|
| 76 |
|
| 77 |
+
questions = get_all_questions(int(chapter_num), conceptual_list, problem_list, conceptual_url, problem_url)
|
| 78 |
template_str = '''
|
| 79 |
<!DOCTYPE html>
|
| 80 |
<html>
|
| 81 |
<head>
|
| 82 |
<title>Chapter {{ chapter_number }} Questions</title>
|
| 83 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css">
|
| 84 |
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.js"></script>
|
| 85 |
+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/contrib/auto-render.min.js"
|
| 86 |
+
onload="renderMathInElement(document.body);"></script>
|
| 87 |
<style>
|
| 88 |
body {
|
| 89 |
font-family: 'Calibri', sans-serif;
|
|
|
|
| 92 |
.page-break {
|
| 93 |
page-break-after: always;
|
| 94 |
}
|
| 95 |
+
.mathjax {
|
| 96 |
+
display: inline-block;
|
| 97 |
+
}
|
| 98 |
</style>
|
| 99 |
</head>
|
| 100 |
<body>
|
| 101 |
<div>
|
| 102 |
+
<h2>Chapter: {{ chapter_number }}</h2>
|
| 103 |
{% if conceptual_problem_list %}
|
| 104 |
<h2>Conceptual Problems: {{ conceptual_problem_list|join(", ") }}</h2>
|
| 105 |
<p><a href="{{ conceptual_url }}">{{ conceptual_url }}</a></p>
|
|
|
|
| 112 |
<div class="page-break"></div>
|
| 113 |
|
| 114 |
{% for question in questions %}
|
| 115 |
+
<div class="mathjax">{{ question|safe }}</div>
|
| 116 |
<div class="page-break"></div>
|
| 117 |
{% endfor %}
|
| 118 |
</body>
|