From 6a9f8572c97c3ad4434ece5a0376f7b0e01202ca Mon Sep 17 00:00:00 2001 From: veclav talica Date: Mon, 22 May 2023 18:29:58 +0500 Subject: [PATCH] move MONTHS to page_shares, add weekday dict --- tools/article_utils.py | 15 --------------- tools/article_wrapper.py | 4 ++-- tools/main_page_generator.py | 4 ++-- tools/page_shares.py | 25 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/tools/article_utils.py b/tools/article_utils.py index f876153..86d4e41 100644 --- a/tools/article_utils.py +++ b/tools/article_utils.py @@ -1,20 +1,5 @@ import time, subprocess -MONTHS = { - 1: "January", - 2: "February", - 3: "March", - 4: "April", - 5: "May", - 6: "June", - 7: "July", - 8: "August", - 9: "September", - 10: "October", - 11: "November", - 12: "December" -} - def the_line_after_metadata(lines: []) -> int: i = 0 while lines[i].strip(): diff --git a/tools/article_wrapper.py b/tools/article_wrapper.py index 85ed8c3..4212a1a 100755 --- a/tools/article_wrapper.py +++ b/tools/article_wrapper.py @@ -5,8 +5,8 @@ from sys import argv, exit import time -from article_utils import the_line_after_metadata, parse_metadata, MONTHS -from page_shares import wrap_page +from article_utils import the_line_after_metadata, parse_metadata +from page_shares import wrap_page, MONTHS if len(argv) <= 1: print("No file was supplied") diff --git a/tools/main_page_generator.py b/tools/main_page_generator.py index dc6ec53..768cad5 100755 --- a/tools/main_page_generator.py +++ b/tools/main_page_generator.py @@ -5,8 +5,8 @@ from os import walk, path from random import choice, seed import time, urllib.parse -from article_utils import parse_metadata, MONTHS -from page_shares import wrap_page, ADJECTIVES +from article_utils import parse_metadata +from page_shares import wrap_page, ADJECTIVES, MONTHS if len(argv) <= 1: print("No directory was supplied") diff --git a/tools/page_shares.py b/tools/page_shares.py index 57a6259..39a8247 100644 --- a/tools/page_shares.py +++ b/tools/page_shares.py @@ -28,5 +28,30 @@ TAIL_EMBED = """ ADJECTIVES = ["*wild*", "**wacky**", "very humble", "**most serious**"] +MONTHS = { + 1: "January", + 2: "February", + 3: "March", + 4: "April", + 5: "May", + 6: "June", + 7: "July", + 8: "August", + 9: "September", + 10: "October", + 11: "November", + 12: "December" +} + +WEEKDAYS = { + 0: "Monday", + 1: "Tuesday", + 2: "Wednesday", + 3: "Thursday", + 4: "Friday", + 5: "Saturday", + 6: "Sunday" +} + def wrap_page(page: str) -> str: return HEAD_EMBED + page + TAIL_EMBED