Created
February 11, 2021 19:57
-
-
Save 0x4C4A/ee2bbc969ae0a8daa923b1bf292a74be to your computer and use it in GitHub Desktop.
Joplin / Markdown yearly bullet list template generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import calendar | |
if len(sys.argv) != 2: | |
print("Expecting year to be input!") | |
sys.exit(1) | |
year = int(sys.argv[1]) | |
weekNum = 1 | |
for i, quarter in enumerate(calendar.Calendar().yeardayscalendar(year)): | |
for j, month in enumerate(quarter): | |
monthNum = i*3 + j + 1 | |
print(f'# {calendar.month_name[monthNum]}') | |
for week in month: | |
if week[0] != 0: | |
weekNum += 1 | |
print(f'## Week {weekNum}') | |
for weekday, date in enumerate(week): | |
if date == 0: | |
continue | |
print(f'### {str(date).zfill(2)}.{str(monthNum).zfill(2)}.{str(year)[2:]} {calendar.day_name[weekday]}\n') | |
print(f'\n\n') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment