Skip to content

Commit 3b42297

Browse files
authored
Revert "Make MathJax show errors for bad TeX. (alternate approach)"
1 parent 9f8587f commit 3b42297

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

htdocs/js/MathJaxConfig/mathjax-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
if (!window.MathJax) {
22
window.MathJax = {
3-
loader: { load: ['input/asciimath'] },
3+
tex: { packages: { '[+]': ['noerrors'] } },
4+
loader: { load: ['input/asciimath', '[tex]/noerrors'] },
45
startup: {
56
ready() {
67
const AM = MathJax.InputJax.AsciiMath.AM;

lib/WeBWorK/ContentGenerator.pm

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use MIME::Base64;
3232
use Scalar::Util qw(weaken);
3333
use HTML::Entities;
3434
use Encode;
35-
use Mojo::JSON qw(encode_json);
3635

3736
use WeBWorK::File::Scoring qw(parse_scoring_file);
3837
use WeBWorK::Localize;
@@ -683,15 +682,20 @@ sub page_title ($c) {
683682
return route_title($c, $c->current_route, 1);
684683
}
685684

686-
=item webwork_js_config
685+
=item webwork_url
687686
688-
Outputs the webwork2 JavaScript configuration. This configuration can be
689-
accessed by JavaScript files to obtain various webwork2 settings.
687+
Defined in this package.
688+
689+
Outputs the $webwork_url defined in site.conf, unless $webwork_url is equal to
690+
"/", in which case this outputs the empty string.
691+
692+
This is used to set a value in a global webworkConfig javascript variable,
693+
that can be accessed in javascript files.
690694
691695
=cut
692696

693-
sub webwork_js_config ($c) {
694-
return encode_json({ webwork_url => $c->location });
697+
sub webwork_url ($c) {
698+
return $c->location;
695699
}
696700

697701
=item warnings()

templates/ContentGenerator/SampleProblemViewer.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<%= javascript $c->url({
1515
type => 'webwork', name => 'htdocs', file => 'node_modules/minisearch/dist/umd/index.js'
1616
}), defer => undef =%>
17-
<script>const webworkConfig = <%== $c->webwork_js_config %>;</script>
17+
<script>const webworkConfig = { webwork_url: '<%= $c->webwork_url %>' };</script>
1818
<%= javascript $c->url({
1919
type => 'webwork', name => 'htdocs', file => 'js/SampleProblemViewer/documentation-search.js'
2020
}), defer => undef =%>

templates/layouts/system.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
% }
2121
%
2222
% # Webwork configuration for javascript
23-
<script>const webworkConfig = <%== $c->webwork_js_config %>;</script>
23+
<script>const webworkConfig = { webwork_url: '<%= $c->webwork_url %>' };</script>
2424
%
2525
% # JS Loads
2626
<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/MathJaxConfig/mathjax-config.js' }),

0 commit comments

Comments
 (0)