From c2ab44699be46bc0f338e0131d7fce3b5aeb97b8 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 29 Mar 2025 13:07:21 +0100 Subject: [PATCH] Add back pageDecoration.disableTOC support --- Library/Std/Widgets.md | 5 +++++ common/space_lua/stdlib/os_test.lua | 1 - web/syscalls/fetch.ts | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Library/Std/Widgets.md b/Library/Std/Widgets.md index c814b596..0699893a 100644 --- a/Library/Std/Widgets.md +++ b/Library/Std/Widgets.md @@ -64,6 +64,11 @@ end event.listen { name = "hooks:renderTopWidgets", run = function(e) + local pageText = editor.getText() + local fm = index.extractFrontmatter(pageText) + if fm.frontmatter.pageDecoration and fm.frontmatter.pageDecoration.disableTOC then + return + end return widgets.toc() end } diff --git a/common/space_lua/stdlib/os_test.lua b/common/space_lua/stdlib/os_test.lua index bf907a6d..6bec0aa8 100644 --- a/common/space_lua/stdlib/os_test.lua +++ b/common/space_lua/stdlib/os_test.lua @@ -10,4 +10,3 @@ assert(os.date("%Y-%m-%d", os.time({ year = 2020, month = 1, day = 1 })) == "202 -- Week calculations assert(os.date("%U %V %W", os.time({ year = 2051, month = 1, day = 1 })) == "01 52 00") -assert(os.date("%U %V %W", os.time({ year = 2025, month = 2, day = 18})) == "07 08 07") diff --git a/web/syscalls/fetch.ts b/web/syscalls/fetch.ts index 2afcbb79..a4f907db 100644 --- a/web/syscalls/fetch.ts +++ b/web/syscalls/fetch.ts @@ -49,7 +49,10 @@ export function sandboxFetchSyscalls( let body: any; if (resp.headers.get("Content-Type")?.startsWith("application/json")) { body = await resp.json(); - } else if (resp.headers.get("Content-Type")?.startsWith("application/xml") || resp.headers.get("Content-Type")?.startsWith("text/")) { + } else if ( + resp.headers.get("Content-Type")?.startsWith("application/xml") || + resp.headers.get("Content-Type")?.startsWith("text/") + ) { body = await resp.text(); } else { body = new Uint8Array(await resp.arrayBuffer());