mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-12 17:40:52 +01:00
Made kalk_web symbol completion code cleaner
This commit is contained in:
parent
536c6962d6
commit
4c3af6556e
@ -86,39 +86,36 @@
|
||||
/(?<identifier>[^!-@\s_|^⌊⌋⌈⌉]+(_\d+)?)|(?<op>[+\-/*%^!])/g,
|
||||
(substring, identifier, _, op) => {
|
||||
if (identifier) {
|
||||
let newSubstring: string;
|
||||
switch (substring) {
|
||||
case "sqrt": {
|
||||
substring = "√";
|
||||
offset += 3;
|
||||
newSubstring = "√";
|
||||
break;
|
||||
}
|
||||
case "sum": {
|
||||
substring = "Σ";
|
||||
offset += 2;
|
||||
newSubstring = "Σ";
|
||||
break;
|
||||
}
|
||||
case "pi": {
|
||||
substring = "π";
|
||||
offset += 1;
|
||||
newSubstring = "π";
|
||||
break;
|
||||
}
|
||||
case "gamma": {
|
||||
substring = "Γ";
|
||||
offset += 4;
|
||||
newSubstring = "Γ";
|
||||
break;
|
||||
}
|
||||
case "floor": {
|
||||
substring = "⌊⌋";
|
||||
offset += 3;
|
||||
newSubstring = "⌊⌋";
|
||||
break;
|
||||
}
|
||||
case "ceil": {
|
||||
substring = "⌈⌉";
|
||||
offset += 3;
|
||||
newSubstring = "⌈⌉";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
offset += substring.length - newSubstring.length;
|
||||
|
||||
return `<span class="identifier">${substring}</span>`;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user