10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Add toString and toLatex for output

This commit is contained in:
Mickaël Véril 2019-09-03 15:36:32 +02:00
parent 222645b487
commit 68bab37397

View File

@ -1,13 +1,27 @@
class code { class code {
constructor(name,version){ constructor(name,version){
this.name=name this.name=name;
this.version=version this.version=version;
};
toString() {
var str=this.name;
if (this.version) {
str=str+' ('+this.version+')';
}
return str;
} }
} }
class basis { class basis {
constructor(name,type){ constructor(name,type){
this.name=name this.name=name;
this.type=type this.type=type;
}
toString() {
var str=this.name;
if (this.type) {
str=str+' ('+this.type+')';
}
return str;
} }
} }
@ -16,15 +30,27 @@ class state{
this.number=number; this.number=number;
this.multiplicity=multiplicity; this.multiplicity=multiplicity;
this.symetry=symetry; this.symetry=symetry;
} };
toString() {
var str=this.number+ ' ^'+this.multiplicity+this.symetry;
return str;
};
toLaTeX() {
var tex=this.number;
tex+= String.raw` \vphantom{${this.symetry.charAt(0)}}^{${this.multiplicity}}${this.symetry}`;
return tex;
};
} }
class doi{ class doi{
constructor(doistring){ constructor(doistring){
this.string=doistring this.string=doistring
} };
toString() {
return this.string;
};
get url() { get url() {
return 'https://doi.org/'+doi return 'https://doi.org/'+this.string;
} };
} }
class excitation{ class excitation{
constructor(start,end,Eabs){ constructor(start,end,Eabs){
@ -32,11 +58,14 @@ class excitation{
this.end=end; this.end=end;
this.Eabs=Eabs; this.Eabs=Eabs;
} }
toString() {
return this.start+ ', ' + this.end +', '+ this.Eabs;
}
} }
class data { class data {
constructor(){ constructor(){
this.title=""; this.title='';
this.code=null; this.code=null;
this.basis=null; this.basis=null;
this.doi=null; this.doi=null;