10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-07-23 03:07:44 +02:00

Merge branch 'master' into readXYZ

This commit is contained in:
Mickaël Véril 2020-09-28 09:33:37 +02:00
commit b717bd302b
2 changed files with 18 additions and 8 deletions

View File

@ -24,6 +24,7 @@ draft: false
<script src="/js/numberUtils.js"></script>
<script src="/js/indexDB.js"></script>
<script src="/js/ArrayExtensions.js"></script>
<script src="/js/mhchemCE.js"></script>
<link rel="stylesheet" href="/css/ChemDoodleWeb.css" type="text/css">
<script type="text/javascript" src="/js/ChemDoodleWeb.js"></script>
<script>
@ -255,13 +256,7 @@ draft: false
return "Unnamed set"
}
case "molecule":
const mhchemCE = /^\\ce\{(.*)\}$/
const m = value.match(mhchemCE)
if (m) {
return m[1]
} else {
return value
}
return mhchemCE.extract(value)
break;
default:
return value.toString()
@ -547,7 +542,6 @@ draft: false
}
for (const [molecule, moldat] of datadic.entries()) {
var printmol = true;
const mhchemCE = /^\\ce\{.*\}$/
for (const [jsonex, exdat] of moldat.entries()) {
const ex = JSON.parse(jsonex)
Reflect.setPrototypeOf(ex[0], state.prototype)

16
static/js/mhchemCE.js Normal file
View File

@ -0,0 +1,16 @@
class mhchemCE{
static extract(string) {
const m = string.match(mhchemCE.regEx)
if (m) {
return m[1]
} else {
return string
}
}
static test(string){
return mhchemCE.regEx.test(string)
}
static get regEx(){
return /^\\ce\{(.*)\}$/
}
}