Skip to content

Commit ab5ee03

Browse files
committed
Add code to fix older pages using JQ with multiple quizzes in one Jupyter book
1 parent d5ec9a8 commit ab5ee03

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

jupyterquiz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
All files in the package are distributed under the MIT License
1212
'''
1313

14-
__version__ = '2.9.4'
14+
__version__ = '2.9.5'
1515
from .dynamic import display_quiz, capture_responses

jupyterquiz/dynamic/loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ def load_questions_script(ref, div_id):
6666
else:
6767
raise Exception("First argument must be list, URL, or file ref")
6868
# Terminate statement
69-
script += ";\n"
70-
return script, static, url
69+
script += ";\n\nif (typeof Question === 'undefined') {\n"
70+
return script, static, url

jupyterquiz/dynamic/renderer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ def build_script(prefix_script, static, url, div_id, load_js):
6464
tpl = tpl_path.read_text()
6565
script += Template(tpl).substitute(url=url, div_id=div_id)
6666

67+
# Append the final script
68+
script += '\n}\n'
69+
70+
71+
6772
return script

0 commit comments

Comments
 (0)