Daily Notes Parsing Errors #1467
Unanswered
danni-storm
asked this question in
Help
Replies: 2 comments
-
The following makes use of Templaters Execution Command to wrap your monday section in conditional logic. ---
<%*
// Rename the file as needed
if (tp.file.title == 'Untitled') {
await tp.file.rename(tp.date.now('YYYY-MM-DD'));
}
const today = tp.file.title;
// Get the current date
const mmt = moment();
// Find the date of the last Monday and next Monday
let lastMonday = mmt.clone().weekday(1);
let nextMonday = mmt.clone().weekday(8)
// If today is Monday, move to the previous Monday
if (mmt.weekday() === 1) {
lastMonday = mmt.clone().subtract(7, 'days');
nextMonday = mmt.clone().add(7, 'days')
}
// Format the date
let lastMondayFormatted = lastMonday.format("YYYY-MM-DD");
let nextMondayFormatted = nextMonday.format("YYYY-MM-DD");
const dayOfWk = tp.date.now('dddd');
const yesterday = tp.date.now("YYYY-MM-DD", -1, today, "YYYY-MM-DD");
const tomorrow = tp.date.now("YYYY-MM-DD", 1, today, "YYYY-MM-DD");
let nav = `[[${lastMondayFormatted}]] | [[${yesterday}]] | [[${tomorrow}]] | [[${nextMondayFormatted}]]`
-%>
title: <% today %>
tags:
- daily
---
# <% today %>
<% nav %>
<%* if (dayOfWk == 'Monday') { %>
### Weekly Plan:
---
#### Research
- [ ]
#### Projects
- [ ]
#### Personal
- [ ]
<%* } %>
### Todo:
---
#### Research
- [ ]
#### Projects
- [ ]
#### Personal
- [ ]
### Notes:
---
#### Research Notes
#### Projects Notes
#### Personal Notes |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been using this daily note format for awhile. The only real templating in this is my breadcrumb navigation menu at the top. It works well but I find myself having to modify the resulting daily note frequently, especially on Mondays when I plan out my week.
So I embarked on trying to improve and well...my experience is mainly in Python so it's been a rough journey. I have a lot of this worked out but I am running into parsing errors. I was hoping someone might be able to help me figure out what is wrong with the following template as I am kind of stabbing in the dark hoping I hit the problem. Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions