Skip to content

Commit ecc7d01

Browse files
committed
Code tidy and doc update.
1 parent 65111e7 commit ecc7d01

61 files changed

Lines changed: 185 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/controller/RenderController.php

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,24 +163,50 @@ public function __invoke(Request $request, Response $response, array $args): Res
163163
$feedbackprefix = trim($feedbackprefix);
164164
preg_match_all('/\[\[input:([^\]]*)\]\]/', $renderresponse->questionrender, $inputtags);
165165
foreach ($inputtags[1] as $tag) {
166-
$renderresponse->questionrender = str_replace("[[input:{$tag}]]", $renderresponse->questioninputs->$tag->render, $renderresponse->questionrender);
167-
$renderresponse->questionrender = str_replace("[[validation:{$tag}]]", "<span name='{$validationprefix}{$tag}'></span>", $renderresponse->questionrender);
166+
$renderresponse->questionrender = str_replace(
167+
"[[input:{$tag}]]",
168+
$renderresponse->questioninputs->$tag->render,
169+
$renderresponse->questionrender
170+
);
171+
$renderresponse->questionrender = str_replace(
172+
"[[validation:{$tag}]]",
173+
"<span name='{$validationprefix}{$tag}'></span>",
174+
$renderresponse->questionrender
175+
);
168176
}
169177
foreach ($renderresponse->iframes as $iframe) {
170178
$iframe[1] = str_replace('<head>', "<head><base href=\"{$baseurl}\" />", $iframe[1]);
171-
$renderediframe = "<iframe id=\"{$iframe[0]}\" style=\"width: 100%; height: 100%; border: 0;" . ($iframe[4] === 'false' ? ' overflow: hidden;' : '') . "\" scrolling=\"" . ($iframe[4] === 'false' ? 'no' : 'yes') . "\" title=\"{$iframe[4]}\" referrerpolicy=\"no-referrer\" " . (!$iframe[5] ? 'allow-scripts allow-downloads ' : '') . "srcdoc=\"" . htmlentities($iframe[1]) . "\"></iframe>";
172-
$renderresponse->questionrender = str_replace("id=\"{$iframe[2]}\"></div>", "id=\"{$iframe[2]}\">{$renderediframe}</div>", $renderresponse->questionrender);
173-
$renderresponse->questionsamplesolutiontext = str_replace("id=\"{$iframe[2]}\"></div>", "id=\"{$iframe[2]}\">{$renderediframe}</div>", $renderresponse->questionsamplesolutiontext);
179+
$renderediframe = "<iframe id=\"{$iframe[0]}\" style=\"width: 100%; height: 100%; border: 0;" .
180+
($iframe[4] === 'false' ? ' overflow: hidden;' : '') . "\" scrolling=\"" .
181+
($iframe[4] === 'false' ? 'no' : 'yes') .
182+
"\" title=\"{$iframe[4]}\" referrerpolicy=\"no-referrer\" " .
183+
(!$iframe[5] ? 'allow-scripts allow-downloads ' : '') .
184+
"srcdoc=\"" . htmlentities($iframe[1]) . "\"></iframe>";
185+
$renderresponse->questionrender = str_replace(
186+
"id=\"{$iframe[2]}\"></div>",
187+
"id=\"{$iframe[2]}\">{$renderediframe}</div>",
188+
$renderresponse->questionrender
189+
);
190+
$renderresponse->questionsamplesolutiontext = str_replace(
191+
"id=\"{$iframe[2]}\"></div>", "id=\"{$iframe[2]}\">{$renderediframe}</div>",
192+
$renderresponse->questionsamplesolutiontext
193+
);
174194
}
175195
foreach ($renderresponse->questionassets as $name => $file) {
176196
$renderresponse->questionrender = str_replace($name, "{$baseurl}/plots/{$file}", $renderresponse->questionrender);
177-
$renderresponse->questionsamplesolutiontext = str_replace($name, "{$baseurl}/plots/{$file}", $renderresponse->questionsamplesolutiontext);
197+
$renderresponse->questionsamplesolutiontext = str_replace(
198+
$name,
199+
"{$baseurl}/plots/{$file}", $renderresponse->questionsamplesolutiontext
200+
);
178201
foreach ($renderresponse->questioninputs as $input) {
179202
$input->samplesolutionrender = str_replace($name, "{$baseurl}/plots/{$file}", $input->samplesolutionrender);
180203
}
181204
}
182205
$renderresponse->questionrender = $this->replace_feedback_tags($renderresponse->questionrender, $feedbackprefix);
183-
$renderresponse->questionsamplesolutiontext = $this->replace_feedback_tags($renderresponse->questionsamplesolutiontext, $feedbackprefix);
206+
$renderresponse->questionsamplesolutiontext = $this->replace_feedback_tags(
207+
$renderresponse->questionsamplesolutiontext,
208+
$feedbackprefix
209+
);
184210
}
185211

186212
$response->getBody()->write(json_encode($renderresponse));

cli/stack_maxima_compiler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ function comment_annotations(string $comment): array {
416416
false
417417
);
418418

419-
420419
$ast = null;
421420
try {
422421
$ast = $parser->parse($po->get_lexer($content));
@@ -641,7 +640,7 @@ function comment_annotations(string $comment): array {
641640
$doc = '<!-- NOTE! This file is autogenerated from files under stack/maximasrc do not edit here. -->';
642641
$rootlink = str_repeat('../', substr_count($path, '/'));
643642

644-
$doc .= "\n# Section documentation for [STACK-Maxima]($rootlink) $path\n\n";
643+
$doc .= "\n# Section documentation for [STACK-Maxima]({$rootlink}index.md) $path\n\n";
645644

646645

647646
if ($node->description !== '') {

doc/en/Authoring/Answer_Tests/Results/AddConst.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>AddConst</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>AddConst</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">AddConst</td>
@@ -21,7 +21,7 @@ This page exposes the results of running answer tests on STACK test cases. This
2121
</tr>
2222
<tr class="expectedfail">
2323
<td class="cell c0"><td colspan="2"></td></td>
24-
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Missing option when executing the test. </td></td>
24+
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Option field is invalid. </td></td>
2525
</tr>
2626
<tr class="expectedfail">
2727
<td class="cell c0">AddConst</td>
@@ -38,7 +38,7 @@ This page exposes the results of running answer tests on STACK test cases. This
3838
</tr>
3939
<tr class="expectedfail">
4040
<td class="cell c0"><td colspan="2"></td></td>
41-
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Missing option when executing the test. </td></td>
41+
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Option field is invalid. </td></td>
4242
</tr>
4343
<tr class="expectedfail">
4444
<td class="cell c0">AddConst</td>

doc/en/Authoring/Answer_Tests/Results/AlgEquiv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>AlgEquiv</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>AlgEquiv</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">AlgEquiv</td>

doc/en/Authoring/Answer_Tests/Results/AlgEquivNouns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>AlgEquivNouns</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>AlgEquivNouns</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">AlgEquivNouns</td>

doc/en/Authoring/Answer_Tests/Results/Antidiff.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>Antidiff</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>Antidiff</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">Antidiff</td>
@@ -21,7 +21,7 @@ This page exposes the results of running answer tests on STACK test cases. This
2121
</tr>
2222
<tr class="expectedfail">
2323
<td class="cell c0"><td colspan="2"></td></td>
24-
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Missing option when executing the test. </td></td>
24+
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Option field is invalid. </td></td>
2525
</tr>
2626
<tr class="expectedfail">
2727
<td class="cell c0">Antidiff</td>

doc/en/Authoring/Answer_Tests/Results/CasEqual.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>CasEqual</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>CasEqual</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">CasEqual</td>

doc/en/Authoring/Answer_Tests/Results/CompSquare.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>CompSquare</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>CompSquare</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">CompSquare</td>
@@ -21,7 +21,7 @@ This page exposes the results of running answer tests on STACK test cases. This
2121
</tr>
2222
<tr class="expectedfail">
2323
<td class="cell c0"><td colspan="2"></td></td>
24-
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Missing option when executing the test. </td></td>
24+
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Option field is invalid. </td></td>
2525
</tr>
2626
<tr class="expectedfail">
2727
<td class="cell c0">CompSquare</td>

doc/en/Authoring/Answer_Tests/Results/Diff.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>Diff</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>Diff</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">Diff</td>
@@ -21,7 +21,7 @@ This page exposes the results of running answer tests on STACK test cases. This
2121
</tr>
2222
<tr class="expectedfail">
2323
<td class="cell c0"><td colspan="2"></td></td>
24-
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Missing option when executing the test. </td></td>
24+
<td class="cell c1"><td colspan="4">The answer test failed to execute correctly: please alert your teacher. Option field is invalid. </td></td>
2525
</tr>
2626
<tr class="expectedfail">
2727
<td class="cell c0">Diff</td>

doc/en/Authoring/Answer_Tests/Results/EqualComAss.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This page exposes the results of running answer tests on STACK test cases. This
44

55

66

7-
<h2>EqualComAss</h2><div class="table-responsive"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
7+
<h2>EqualComAss</h2><div class="no-overflow"><table class="flexible table table-striped table-hover generaltable generalbox stacktestsuite"><thead><tr><th class="header c0" scope="col">Test<div class="commands"></div></th><th class="header c1" scope="col">?<div class="commands"></div></th><th class="header c2" scope="col">Student response<div class="commands"></div></th><th class="header c3" scope="col">Teacher answer<div class="commands"></div></th><th class="header c4" scope="col">Opt<div class="commands"></div></th><th class="header c5" scope="col">Mark<div class="commands"></div></th><th class="header c6" scope="col">Answer note<div class="commands"></div></th>
88
</tr></thead><tbody>
99
<tr class="expectedfail">
1010
<td class="cell c0">EqualComAss</td>

0 commit comments

Comments
 (0)