From 24088965edd2b49b61b44a200ad10864e5540d98 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Thu, 20 Oct 2022 23:27:47 -0400 Subject: [PATCH] tasks --- tasks.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tasks.py b/tasks.py index 704f357..e635bf3 100644 --- a/tasks.py +++ b/tasks.py @@ -148,22 +148,19 @@ def new_post(c): import os from slugify import slugify iso_date = datetime.datetime.today().strftime('%Y-%m-%d') - year, month, day = iso_date.split("-") title = input("Title: ") slug = slugify(title) filename = f"{iso_date}_{slug}.rst" title_header = "#" * len(title) template = f"""{title} {title_header} -:date: {datetime.datetime.today().strftime('%Y-%m-%d %H:%M')} :author: tyrel :category: ???? :tags: ???? -:slug: {slug} :status: draft """ - base = f"content/blog/{year}/{month}" + base = f"content/blog" os.makedirs(os.path.dirname(base), exist_ok=True) with open(f"{base}/{filename}", "w") as f: f.write(template)