10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00

Add support for \ce latex command

This commit is contained in:
Mickaël Véril 2020-04-27 16:50:17 +02:00
parent 440787408b
commit b2890c266e

View File

@ -202,13 +202,29 @@ draft: false
return undefined return undefined
} }
})() })()
textSelctor=function(value){
switch (name) {
case "DOI":
return sets.has(value) ? sets.get(value) : value.toString()
break;
case "molecule":
const mhchemCE=/^\\ce\{.*\}$/
return mhchemCE.test(value) ? "\\("+value.toString()+"\\)" : value.toString()
break;
default:
return value.toString()
}
}
for (const val of vals) { for (const val of vals) {
if (val !== null) { if (val !== null) {
$("<option/>", { $("<option/>", {
value: val value: val
}).text((name === "DOI" && sets.has(val)) ? sets.get(val) : val.toString()).appendTo(currentselect) }).text(textSelctor(val)).appendTo(currentselect)
} }
} }
if (name==="molecule") {
await MathJax.typesetPromise()
}
} }
function getSelectValue(data, name) { function getSelectValue(data, name) {
switch (name) { switch (name) {
@ -498,6 +514,7 @@ draft: false
} }
for (const [molecule, moldat] of datadic.entries()) { for (const [molecule, moldat] of datadic.entries()) {
var printmol = true; var printmol = true;
const mhchemCE=/^\\ce\{.*\}$/
for (const [jsonex, exdat] of moldat.entries()) { for (const [jsonex, exdat] of moldat.entries()) {
const ex = JSON.parse(jsonex) const ex = JSON.parse(jsonex)
Reflect.setPrototypeOf(ex[0], state.prototype) Reflect.setPrototypeOf(ex[0], state.prototype)
@ -506,7 +523,7 @@ draft: false
Reflect.setPrototypeOf(ex[3], VertExcitationKind.prototype) Reflect.setPrototypeOf(ex[3], VertExcitationKind.prototype)
var tr = $("<tr/>") var tr = $("<tr/>")
if (printmol) { if (printmol) {
$("<th/>", { scope: "row", rowspan: moldat.size }).text(molecule).appendTo(tr) $("<th/>", { scope: "row", rowspan: moldat.size }).text((mhchemCE.test(molecule) ? MathJaxUtils.getMathJaxString(molecule.toString()) : molecule)).appendTo(tr)
printmol = false printmol = false
} }
var Vertkindtext = "" var Vertkindtext = ""
@ -580,6 +597,7 @@ draft: false
<p> <p>
In this page you can compare multiple dataset and have somme statistics to evaluate method or basis accuracy. In this page you can compare multiple dataset and have somme statistics to evaluate method or basis accuracy.
For this follow this steps For this follow this steps
\(\ce{CF2}\)
<ol> <ol>
<li>Add custom files</li> <li>Add custom files</li>
<ul> <ul>