Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 8bb0e20

Browse files
authored
Merge branch 'RunestoneInteractive:master' into master
2 parents 4674a5d + 9b32953 commit 8bb0e20

File tree

12 files changed

+155
-100
lines changed

12 files changed

+155
-100
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ license = "GPL"
3434
name = "runestone"
3535
readme = "README.rst"
3636
repository = "https://github.com/RunestoneInteractive/RunestoneComponents"
37-
version = "6.3.20"
37+
version = "6.3.23"
3838

3939
# See https://python-poetry.org/docs/pyproject/#include-and-exclude.
4040
include = [

runestone/activecode/js/activecode.js

Lines changed: 76 additions & 52 deletions
Large diffs are not rendered by default.

runestone/activecode/js/activecode_sql.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ export default class SQLActiveCode extends ActiveCode {
304304
result += "\n";
305305
}
306306
let pct = (100 * this.passed) / (this.passed + this.failed);
307+
if (isNaN(pct)) {
308+
pct = 0.0;
309+
}
307310
pct = pct.toLocaleString(undefined, { maximumFractionDigits: 2 });
308311
result += `You passed ${this.passed} out of ${
309312
this.passed + this.failed
@@ -319,6 +322,7 @@ export default class SQLActiveCode extends ActiveCode {
319322
actual = result_table.values[row][col];
320323
} catch (e) {
321324
output = `Failed Not enough data to check row ${row} or column ${col}`;
325+
this.failed++;
322326
return output;
323327
}
324328
const operators = {

runestone/clickableArea/js/clickable.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export default class ClickableArea extends RunestoneBase {
4646
this.caption = "Clickable";
4747
this.addCaption("runestone");
4848
this.checkServer("clickableArea", true);
49+
if (typeof Prism !== "undefined") {
50+
Prism.highlightAllUnder(this.containerDiv);
51+
}
4952
}
5053
/*===========================
5154
== Update basic attributes ==

runestone/common/js/runestonebase.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,16 @@ export default class RunestoneBase {
157157
throw new Error(`Failed to save the log entry
158158
Status: ${response.status}`);
159159
}
160-
post_return = response.json();
160+
post_return = await response.json();
161161
} catch (e) {
162162
let detail = "none";
163-
if (post_return.detail) {
163+
if (post_return && post_return.detail) {
164164
detail = post_return.detail;
165165
}
166166
if (eBookConfig.loginRequired) {
167-
alert(`Error: Your action was not saved!
168-
The error was ${e}
169-
Detail: ${detail}.
167+
alert(`Error: Your action was not saved!
168+
The error was ${e}
169+
Detail: ${detail}.
170170
Please report this error!`);
171171
}
172172
// send a request to save this error
@@ -449,7 +449,7 @@ export default class RunestoneBase {
449449
// See - https://docs.mathjax.org/en/latest/advanced/typeset.html
450450
// Per the above we should keep track of the promises and only call this
451451
// a second time if all previous promises have resolved.
452-
MathJax.typesetPromise([component]);
452+
return MathJax.typesetPromise([component]);
453453
}
454454
}
455455
}

runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ <h4>Before you keep reading...</h4>
341341
{% if dynamic_pages == 'True' %}
342342
{% raw %}
343343
{% if show_ethical_ad %}
344-
<div data-ea-publisher="runestoneacademy" data-ea-type="text"></div>
344+
<div data-ea-publisher="runestoneacademy" data-ea-type="image" data-ea-style="stickybox"></div>
345345
{% endif %}
346346
{% endraw %}
347347
{% endif %}

runestone/datafile/__init__.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
RunestoneIdDirective,
2828
RunestoneIdNode,
2929
)
30+
import pdb
3031

3132

3233
def setup(app):
@@ -38,7 +39,7 @@ def setup(app):
3839
app.connect("env-purge-doc", purge_datafiles)
3940

4041

41-
TEMPLATE = u"""
42+
TEMPLATE = """
4243
<div class="runestone datafile %(optclass)s">
4344
<div class="datafile_caption">Data file: <code>%(divid)s</code></div>
4445
<pre data-component="datafile" id=%(divid)s %(hidden)s data-edit="%(edit)s" data-rows="%(rows)s" data-cols="%(cols)s">
@@ -55,6 +56,7 @@ def setup(app):
5556
class DataFileNode(nodes.General, nodes.Element, RunestoneIdNode):
5657
pass
5758

59+
5860
# self for these functions is an instance of the writer class. For example
5961
# in html, self is sphinx.writers.html.SmartyPantsHTMLTranslator
6062
# The node that is passed as a parameter is an instance of our node class.
@@ -74,9 +76,9 @@ def visit_df_html(self, node):
7476

7577

7678
def depart_df_html(self, node):
77-
""" This is called at the start of processing an datafile node. If datafile had recursive nodes
78-
etc and did not want to do all of the processing in visit_ac_html any finishing touches could be
79-
added here.
79+
"""This is called at the start of processing an datafile node. If datafile had recursive nodes
80+
etc and did not want to do all of the processing in visit_ac_html any finishing touches could be
81+
added here.
8082
"""
8183
pass
8284

@@ -91,14 +93,14 @@ def purge_datafiles(app, env, docname):
9193

9294
class DataFile(RunestoneIdDirective):
9395
"""
94-
.. datafile:: identifier
95-
:edit: Option that makes the datafile editable
96-
:cols: If editable, number of columns--default is 20
97-
:rows: If editable, number of rows--default is 40
98-
:hide: Flag that sets a non-editable datafile to be hidden
99-
:image: Flag that says this file is an image implies :fromfile: will be used
100-
:fromfile: path to file that contains the data
101-
"""
96+
.. datafile:: identifier
97+
:edit: Option that makes the datafile editable
98+
:cols: If editable, number of columns--default is 20
99+
:rows: If editable, number of rows--default is 40
100+
:hide: Flag that sets a non-editable datafile to be hidden
101+
:image: Flag that says this file is an image implies :fromfile: will be used
102+
:fromfile: path to file that contains the data
103+
"""
102104

103105
required_arguments = 1
104106
optional_arguments = 0
@@ -117,16 +119,16 @@ class DataFile(RunestoneIdDirective):
117119

118120
def run(self):
119121
"""
120-
process the multiplechoice directive and generate html for output.
121-
:param self:
122-
:return:
123-
.. datafile:: identifier
124-
:edit: Option that makes the datafile editable
125-
:cols: If editable, number of columns--default is 20
126-
:rows: If editable, number of rows--default is 40
127-
:hide: Flag that sets a non-editable datafile to be hidden
128-
:image:
129-
:fromfile: path to file that contains the data
122+
process the multiplechoice directive and generate html for output.
123+
:param self:
124+
:return:
125+
.. datafile:: identifier
126+
:edit: Option that makes the datafile editable
127+
:cols: If editable, number of columns--default is 20
128+
:rows: If editable, number of rows--default is 40
129+
:hide: Flag that sets a non-editable datafile to be hidden
130+
:image:
131+
:fromfile: path to file that contains the data
130132
"""
131133
super(DataFile, self).run()
132134
env = self.state.document.settings.env

runestone/dragndrop/js/dragndrop.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export default class DragNDrop extends RunestoneBase {
3838
this.createNewElements();
3939
this.caption = "Drag-N-Drop";
4040
this.addCaption("runestone");
41+
if (typeof Prism !== "undefined") {
42+
Prism.highlightAllUnder(this.containerDiv);
43+
}
4144
}
4245
/*======================
4346
=== Update variables ===
@@ -104,7 +107,6 @@ export default class DragNDrop extends RunestoneBase {
104107
if (typeof runestoneMathready !== "undefined") {
105108
runestoneMathReady.then(() => self.queueMathJax(self.containerDiv));
106109
}
107-
108110
}
109111
finishSettingUp() {
110112
this.appendReplacementSpans();

runestone/fitb/js/fitb.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export default class FITB extends RunestoneBase {
3030
this.caption = "Fill in the Blank";
3131
this.addCaption("runestone");
3232
this.checkServer("fillb", true);
33+
if (typeof Prism !== "undefined") {
34+
Prism.highlightAllUnder(this.containerDiv);
35+
}
3336
}
3437
// Find the script tag containing JSON in a given root DOM node.
3538
scriptSelector(root_node) {

runestone/mchoice/js/mchoice.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export default class MultipleChoice extends RunestoneBase {
5656
if (typeof runestoneMathready !== "undefined") {
5757
runestoneMathReady.then(() => self.queueMathJax(self.containerDiv));
5858
}
59+
if (typeof Prism !== "undefined") {
60+
Prism.highlightAllUnder(this.containerDiv);
61+
}
5962
}
6063

6164
/*====================================

0 commit comments

Comments
 (0)