From 71a0f3cac28a3824d700c592101caea4419386fb Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Wed, 13 Dec 2023 08:47:20 +0100 Subject: [PATCH] changed: remove empty entries in journal --- main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 2da72b8..995d755 100644 --- a/main.js +++ b/main.js @@ -3016,9 +3016,13 @@ function loadnote(name) if (gettags(note).includes("journal")) { + // remove empty entries + note.content = note.content.replace(/\d{4}-\d{2}-\d{2}\n*(\d{4}-\d{2}-\d{2})/g, "$1"); + + // create new entry for today var hat = headerandtext(note); var today = timestamp().substr(0,10); - if (!hat.text.startsWith("\n" + today)) + if (!hat.text.startsWith(today) && !hat.text.startsWith("\n" + today)) { note.content = hat.header + "\n" + today + "\n\n" + hat.text; note.pos = hat.header.length + 12;