Skip to content
Snippets Groups Projects
Commit 9a95cc5c authored by Jasper Clemens Gräflich's avatar Jasper Clemens Gräflich
Browse files

Add upcoming task section for journals

parent 0d88010d
No related branches found
No related tags found
No related merge requests found
Pipeline #86555 passed
......@@ -47,14 +47,21 @@ def update(new_date):
r'[next](' + f'journal/{new_date}' + ')',
lines[2]
)
# Modify previous entry
with open(previous, "w") as file:
file.writelines(lines)
print(f"[INFO] Updated Entry: {previous}")
# Create new entry
create_entry(previous, lines[lines.index(
"## Upcoming Tasks\n")+1:], new_date)
# Extract upcoming and long-term tasks from previous
upcoming = lines.index("## Upcoming Tasks\n")
long_term = lines.index("## Long-term Tasks\n")
create_entry(previous,
lines[upcoming+1:long_term-1],
lines[long_term+1:],
new_date
)
# Modify MoC
with open("./journal/map-of-contents.md", "a") as moc:
......@@ -68,7 +75,8 @@ def update(new_date):
f"– [Journal](journal/{new_date})\n")
print("[INFO] Updated sidebar")
def create_entry(previous, prev_tasks, day):
def create_entry(previous, prev_tasks, long_term, day):
weekday = day.strftime("%A")
week = day.strftime("%W")
......@@ -79,6 +87,8 @@ def create_entry(previous, prev_tasks, day):
]
lines.extend(prev_tasks)
lines.extend(("\n", "## Upcoming Tasks\n\n", "- [ ]\n\n"))
lines.append("## Long-term Tasks\n")
lines.extend(long_term)
with open(f"./journal/{day}.md", 'w') as file:
file.writelines(lines)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment