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

Commit e5a5e5a

Browse files
committed
Fixes - thinkcspy
1 parent 53b1604 commit e5a5e5a

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

runestone/activecode/activecode.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ def setup(app):
6363
XML_START = """
6464
<listing xml:id="{divid}">
6565
<caption>{caption}</caption>
66-
<program xml:id="{divid}_editor" interactive='yes' language="{language}">
66+
<program xml:id="{divid}_editor" interactive='activecode' language="{language}">
6767
<input>
68-
{initialcode}
68+
{initialcode}
6969
</input>
7070
</program>
7171
</listing>
72-
7372
"""
7473

7574
TEMPLATE_START = """
@@ -97,6 +96,8 @@ class ActivecodeNode(nodes.General, nodes.Element, RunestoneIdNode):
9796

9897

9998
def visit_ac_xml(self, node):
99+
node["runestone_options"]["initialcode"] = node["runestone_options"]["initialcode"].replace(
100+
"<", "&lt;").replace(">", "&gt;")
100101
res = XML_START.format(**node["runestone_options"])
101102
self.output.append(res)
102103

runestone/common/runestonedirective.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from collections import defaultdict
2020
import binascii
2121
import os
22+
import re
2223

2324
from docutils import nodes
2425
from docutils.parsers.rst import directives
@@ -321,7 +322,8 @@ def run(self):
321322
id_ = self.options["divid"] = self.arguments[0]
322323
else:
323324
id_ = self.options["divid"]
324-
325+
if re.match(r"^[0-9_]+", id_):
326+
print(f"BAD DIVID: {id_}")
325327
self.options["qnumber"] = self.getNumber()
326328
# print(f"{id_} is number {self.options['qnumber']}")
327329

runestone/parsons/parsons.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def visit_parsons_xml(self, node):
7272
node["runestone_options"]["adaptive"] = "adaptive='yes'"
7373

7474
if not node["runestone_options"]["noindent"]:
75-
node["runestone_options"]["noindent"] = "indent='yes'"
75+
node["runestone_options"]["noindent"] = "indent='show'"
76+
else:
77+
node["runestone_options"]["noindent"] = "indent='hide'"
7678

7779
if node["runestone_options"]["language"]:
7880
node["runestone_options"]["language"] = node["runestone_options"]["language"].replace(

runestone/quizly/quizly.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class Quizly(RunestoneIdDirective):
118118
optional_arguments = 0
119119
has_content = True
120120
option_spec = RunestoneIdDirective.option_spec.copy()
121-
option_spec.update( {} )
121+
option_spec.update({})
122122

123123
def run(self):
124124
super(Quizly, self).run()
@@ -136,6 +136,7 @@ def run(self):
136136
self.options["controls"] = self.content[:plstart]
137137

138138
quizly_node = QuizlyNode()
139+
quizly_node["runestone_options"] = self.options
139140
quizly_node["quizname"] = str(self.options['controls'][0])
140141
quizly_node["quizname"] = str.strip(quizly_node["quizname"][10:])
141142
quizly_node["template"] = QUIZLY_TEMPLATE.replace(

runestone/shortanswer/shortanswer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setup(app):
4949
"""
5050

5151
XML_START = """
52-
<exercise xml:id={divid} {optional}>
52+
<exercise xml:id="{divid}" {optional}>
5353
<statement>
5454
"""
5555

0 commit comments

Comments
 (0)