From 656f6748433799a1235638857087c3de1e85cd2a Mon Sep 17 00:00:00 2001 From: Araozu Date: Wed, 1 May 2024 07:20:34 -0500 Subject: [PATCH] Fix behavior fo the sidebar --- src/components/Sidebar.astro | 5 ++++- src/layouts/PagesLayout.astro | 9 ++++++--- src/lexer/number_lexer.ts | 2 +- src/pages/learn/error-handling/try.md | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Sidebar.astro b/src/components/Sidebar.astro index 9fdbfbc..62aac52 100644 --- a/src/components/Sidebar.astro +++ b/src/components/Sidebar.astro @@ -5,6 +5,9 @@ const entry: PageEntry = Astro.props.entry; const basePath: string = Astro.props.basePath; const entryPath = entry.path === "index"? "": entry.path; + +const entryUrl = basePath + entryPath + (entryPath.endsWith("/")? "" : "/"); + --- { @@ -12,7 +15,7 @@ const entryPath = entry.path === "index"? "": entry.path;
  • {entry.title} diff --git a/src/layouts/PagesLayout.astro b/src/layouts/PagesLayout.astro index e022d31..41c5b16 100644 --- a/src/layouts/PagesLayout.astro +++ b/src/layouts/PagesLayout.astro @@ -76,7 +76,7 @@ for (const entry of pagesIndex) {
    -
    +
    @@ -133,7 +135,8 @@ for (const entry of pagesIndex) { document.addEventListener("DOMContentLoaded", () => { let current_uri = window.location.pathname; - const sidebar = document.getElementById("sidebar")!; + const sidebar = document.getElementById("sidebar")!.children[0]! as HTMLElement; + console.log(sidebar); const links = sidebar.querySelectorAll("a"); for (const link of [...links]) { if (link.getAttribute("href") === current_uri) { diff --git a/src/lexer/number_lexer.ts b/src/lexer/number_lexer.ts index 0d04620..425b372 100644 --- a/src/lexer/number_lexer.ts +++ b/src/lexer/number_lexer.ts @@ -21,7 +21,7 @@ function scan_decimal(input: string, starting_position: number): [string, number let pos = starting_position; while (pos < input.length) { - const c = input[pos]; + const c = input[pos]!; if (c === ".") { // todo diff --git a/src/pages/learn/error-handling/try.md b/src/pages/learn/error-handling/try.md index 611c435..c760e10 100644 --- a/src/pages/learn/error-handling/try.md +++ b/src/pages/learn/error-handling/try.md @@ -144,6 +144,10 @@ fun sample(Int x) 0.0 } + catch Exception e + { ... } + catch Error e + { ... } } ```