changed: remove empty entries in journal

This commit is contained in:
quenousimporte 2023-12-13 08:47:20 +01:00
parent d6a04cbcb8
commit 71a0f3cac2
1 changed files with 5 additions and 1 deletions

View File

@ -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;