Skip to content

Commit

Permalink
make it work for rest math directive and role
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Apr 24, 2015
1 parent b56427f commit bff1abe
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nikola/data/themes/base-jinja/templates/base_helper.tmpl
Expand Up @@ -64,6 +64,23 @@ lang="{{ lang }}">
{{ social_buttons_code }}
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
{% endmacro %}

Expand Down
17 changes: 17 additions & 0 deletions nikola/data/themes/base/templates/base_helper.tmpl
Expand Up @@ -64,6 +64,23 @@ lang="${lang}">
${social_buttons_code}
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
</%def>

Expand Down
20 changes: 20 additions & 0 deletions nikola/data/themes/bootstrap-jinja/templates/base_helper.tmpl
Expand Up @@ -93,6 +93,26 @@ lang="{{ lang }}">
{{ social_buttons_code }}
<script>
renderMathInElement(document.body);
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
</script>
{% endmacro %}

Expand Down
20 changes: 20 additions & 0 deletions nikola/data/themes/bootstrap/templates/base_helper.tmpl
Expand Up @@ -93,6 +93,26 @@ lang="${lang}">
${social_buttons_code}
<script>
renderMathInElement(document.body);
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
</script>
</%def>

Expand Down
20 changes: 20 additions & 0 deletions nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl
Expand Up @@ -92,6 +92,26 @@ lang="{{ lang }}">
{{ social_buttons_code }}
<script>
renderMathInElement(document.body);
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
</script>
{% endmacro %}

Expand Down
20 changes: 20 additions & 0 deletions nikola/data/themes/bootstrap3/templates/base_helper.tmpl
Expand Up @@ -92,6 +92,26 @@ lang="${lang}">
${social_buttons_code}
<script>
renderMathInElement(document.body);
<script>
renderMathInElement(document.body);
(function(){
$(".math").each(function() {
var texTxt = $(this).text();
el = $(this).get(0);
if(el.tagName == "DIV"){
addDisp = "\\displaystyle";
} else {
addDisp = "";
}
try {
katex.render(addDisp+texTxt, el);
}
catch(err) {
$(this).html("<span class='err'>"+err);
}
});
})();
</script>
</script>
</%def>

Expand Down

0 comments on commit bff1abe

Please sign in to comment.