diff --git a/web/src/KalkCalculator.svelte b/web/src/KalkCalculator.svelte index db6be15..6bdc41b 100644 --- a/web/src/KalkCalculator.svelte +++ b/web/src/KalkCalculator.svelte @@ -277,11 +277,17 @@ let result = input; let offset = 0; result = result.replace( - /(?[<>&]|(\n\s*\}?|\s+))|(?([+\-/*%^!≈]|if|otherwise)|(?[^!-@\s_|^⌊⌋⌈⌉≈\[\]\{\}≠≥≤]+(_\d+)?)\(?)/g, - (substring, _, html, _2, op, identifier) => { - if (html) { + /(?(!=|[<>]=?))|(?[<>&]|(\n\s*\}?|\s+))|(?([+\-/*%^!≈]|if|otherwise)|(?[^!-@\s_|^⌊⌋⌈⌉≈\[\]\{\}≠≥≤]+(_\d+)?)\(?)/g, + (substring, _, comparison, _2, html, _3, op, identifier) => { + if (comparison) { + if (substring == "<=") return "≤"; + if (substring == ">=") return "≥"; + if (substring == "!=") return "≠"; if (substring == "<") return "<"; if (substring == ">") return ">"; + } + + if (html) { if (substring == "&") return "&"; if (substring.startsWith("\n")) { if (substring.endsWith("}")) {