From 7e4d11123e91f5f61ec27dec29f7c63cbed90c13 Mon Sep 17 00:00:00 2001 From: Araozu Date: Mon, 29 Jul 2024 17:40:51 -0500 Subject: [PATCH] Fix error messages where there shouldn't be any --- src/components/Code.astro | 6 +++--- src/components/CodeEditor.astro | 4 ++-- src/components/HeroSection.astro | 2 +- src/components/docs/CodeMin.astro | 2 +- src/pages/index.astro | 4 +++- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/Code.astro b/src/components/Code.astro index ca7a7cd..4e7ed07 100644 --- a/src/components/Code.astro +++ b/src/components/Code.astro @@ -2,7 +2,7 @@ import { native_highlighter } from "../lexer/highlighter"; import CodeError from "./docs/CodeError.astro"; -const { thpcode } = Astro.props; +const { thpcode, no_warnings } = Astro.props; const [native_html, error_type, error_message] = await native_highlighter(thpcode); --- @@ -11,7 +11,7 @@ const [native_html, error_type, error_message] = await native_highlighter(thpcod class="language-thp">thp { - error_message !== null && ( - + no_warnings !== true && error_message !== null && ( + ) } diff --git a/src/components/CodeEditor.astro b/src/components/CodeEditor.astro index 0cf77a1..b310d07 100644 --- a/src/components/CodeEditor.astro +++ b/src/components/CodeEditor.astro @@ -1,11 +1,11 @@ --- import Code from "./Code.astro" -const { thpcode } = Astro.props; +const { thpcode, no_warnings } = Astro.props; ---
- +
diff --git a/src/components/HeroSection.astro b/src/components/HeroSection.astro index 86b5766..a0baa0d 100644 --- a/src/components/HeroSection.astro +++ b/src/components/HeroSection.astro @@ -30,7 +30,7 @@ if (!title) {
- +
diff --git a/src/components/docs/CodeMin.astro b/src/components/docs/CodeMin.astro index 85b1777..3bfc79b 100644 --- a/src/components/docs/CodeMin.astro +++ b/src/components/docs/CodeMin.astro @@ -3,7 +3,7 @@ import { native_highlighter } from "../../lexer/highlighter"; const { thpcode, href } = Astro.props; -const native_html = await native_highlighter(thpcode); +const [native_html] = await native_highlighter(thpcode); --- diff --git a/src/pages/index.astro b/src/pages/index.astro index 2de652d..0d7cc3b 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -24,6 +24,8 @@ case Cat(name, lives) { print("{name} has {lives}") }`; + +const [thp_html] = await native_highlighter(leftTrimDedent(thpcode).join("\n")); --- @@ -118,7 +120,7 @@ case Cat(name, lives)
-

+