Skip to content

Commit

Permalink
Added MathJax to wiki pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
bridger committed Aug 18, 2012
1 parent cecdc34 commit c4512fa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
12 changes: 11 additions & 1 deletion common/templates/mathjax_include.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
##
## mako
## File: templates/mathjax_include.html
##
## Advanced mathjax using 2.0-latest CDN for Dynamic Math
##
## This enables ASCIIMathJAX, and is used by js_textbox


%if mathjax_mode is not Undefined and mathjax_mode == 'wiki':
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
});
</script>
%else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
Expand All @@ -19,6 +28,7 @@
}
});
</script>
%endif

<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
Expand Down
3 changes: 3 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
# still left lying around.
TEMPLATE_DIRS = (
PROJECT_ROOT / "templates",
COMMON_ROOT / 'templates',
COMMON_ROOT / 'lib' / 'capa' / 'capa' / 'templates',
COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
)

TEMPLATE_CONTEXT_PROCESSORS = (
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/main_django.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<body class="{% block bodyclass %}{% endblock %}">
{% include "navigation.html" %}

<section class="content-wrapper">
{% block body %}{% endblock %}

Expand Down
18 changes: 15 additions & 3 deletions lms/templates/wiki/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

{% block headextra %}
{% compressed_css 'course' %}
<script src="{% static 'js/bootstrap-alert.js' %}"></script>
<script src="{% static 'js/bootstrap-collapse.js' %}"></script>
<script src="{% static 'js/bootstrap-modal.js' %}"></script>

<script type="text/javascript">
function ajaxError(){}
Expand All @@ -30,6 +27,21 @@
});
}
</script>


{% addtoblock 'js' %}
{% comment %} These scripts load at the bottom of the body {% endcomment %}

<script src="{% static 'js/bootstrap-alert.js' %}"></script>
<script src="{% static 'js/bootstrap-collapse.js' %}"></script>
<script src="{% static 'js/bootstrap-modal.js' %}"></script>

{% with mathjax_mode='wiki' %}
{% include "mathjax_include.html" %}
{% endwith %}

{% endaddtoblock %}

{% endblock %}


Expand Down
5 changes: 5 additions & 0 deletions lms/templates/wiki/preview_inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ <h1 class="page-header">{{ title }}</h1>

{% compressed_js 'application' %}
{% compressed_js 'module-js' %}

{% with mathjax_mode='wiki' %}
{% include "mathjax_include.html" %}
{% endwith %}

</body>
</html>

Expand Down

0 comments on commit c4512fa

Please sign in to comment.