10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-22 18:57:38 +02:00

Add MathJaxUtils class

This commit is contained in:
Mickaël Véril 2020-04-23 17:12:33 +02:00
parent 332469c2f4
commit ac95dbb6e8
3 changed files with 15 additions and 4 deletions

View File

@ -38,7 +38,7 @@ draft: false
$("input[type='number'].range").trigger("change")
adjustSticky();
$(window).resize(adjustSticky)
const LatexInline = ['\\(', '\\)']
var slist = $("#SelectList")
getAllSelect().each(function () {
$("<li/>").text($('label[for="' + $(this).attr('id') + '"]').text()).appendTo(slist)
@ -79,7 +79,7 @@ draft: false
for (const [name, value] of excitationTypes.All) {
var txt = value.description.string
if (value.description.isLaTeX) {
txt = LatexInline[0] + txt + LatexInline[1]
txt = MathJaxUtils.getMathJaxString(txt)
}
$("<li/>").text(txt).appendTo(extl)
var cbli = $("<li/>")
@ -385,7 +385,6 @@ draft: false
}
doiCache.clear()
processingIndicator.isActive = true
const LatexInline = ['\\(', '\\)']
window.filtData = window.dats
$('#form_dat > fieldset > div > select').each(function () {
const prop = $(this).attr("name")
@ -518,7 +517,7 @@ draft: false
if (ex[2].description.string) {
desctex = "(" + ex[2].description.string + ")"
}
$("<th/>", { scope: "rowgroup" }).text(String.raw`${LatexInline[0]}${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext} ${desctex} ${LatexInline[1]}`).appendTo(tr)
$("<th/>", { scope: "rowgroup" }).text(MathJaxUtils.getMathJaxString(String.raw`${ex[0].toLaTeX()} \rightarrow ${ex[1].toLaTeX()} ${Vertkindtext} ${desctex}`)).appendTo(tr)
var entries = Array.from(exdat.entries())
for (const method of sortedMethods) {
td = $("<td/>").addClass("NumberCell")

View File

@ -3,6 +3,7 @@
<link rel="stylesheet" href="https://unpkg.com/tippy.js@5/themes/light.css" />
<script src="https://unpkg.com/tippy.js@5"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="/js/MathJaxUtils.js"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script>

11
static/js/MathJaxUtils.js Normal file
View File

@ -0,0 +1,11 @@
class MathJaxUtils {
static get start(){
return '\\('
}
static get end(){
return '\\)'
}
static getMathJaxString(string){
return MathJaxUtils.start+string+MathJaxUtils.end
}
}