2023-05-21 14:24:54 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
from sys import argv, exit
|
2023-05-22 11:18:54 +00:00
|
|
|
from random import choice, seed
|
2024-02-24 06:33:57 +00:00
|
|
|
import time
|
2023-05-21 14:24:54 +00:00
|
|
|
|
2024-02-24 06:33:57 +00:00
|
|
|
from article_utils import parse_article_directory, sort_titles_by_date
|
2023-05-22 13:29:58 +00:00
|
|
|
from page_shares import wrap_page, ADJECTIVES, MONTHS
|
2023-05-21 14:24:54 +00:00
|
|
|
|
|
|
|
if len(argv) <= 1:
|
|
|
|
print("No directory was supplied")
|
|
|
|
exit(-1)
|
|
|
|
|
2023-05-22 11:18:54 +00:00
|
|
|
seed()
|
|
|
|
|
2023-05-21 17:23:39 +00:00
|
|
|
page_metadata = """Title: mjestečko
|
2023-05-21 14:24:54 +00:00
|
|
|
CSS: /style.css
|
2024-02-23 17:52:11 +00:00
|
|
|
HTML header: <meta name="viewport" content="width=device-width, initial-scale=1">
|
2023-05-21 14:24:54 +00:00
|
|
|
|
2023-05-21 17:23:39 +00:00
|
|
|
"""
|
|
|
|
|
2024-02-23 18:19:21 +00:00
|
|
|
page = f"""![](/logo.png)
|
|
|
|
|
|
|
|
Personal blog of one {choice(ADJECTIVES)} Veclav Talica.
|
2023-05-21 14:24:54 +00:00
|
|
|
|
|
|
|
### Articles ###
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2024-02-24 06:33:57 +00:00
|
|
|
artciles = parse_article_directory(argv[1])
|
|
|
|
|
|
|
|
for title in sort_titles_by_date(artciles):
|
2024-02-10 15:58:08 +00:00
|
|
|
article = artciles[title]
|
|
|
|
metadata = article["metadata"]
|
|
|
|
page += (
|
2024-02-10 17:19:17 +00:00
|
|
|
f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{title}.html)\n\n"""
|
2024-02-10 15:58:08 +00:00
|
|
|
f""">{metadata.get("Brief", "")}\n\n"""
|
|
|
|
)
|
|
|
|
|
2023-05-21 14:24:54 +00:00
|
|
|
curtime = time.gmtime(int(time.time()))
|
2023-05-22 19:03:16 +00:00
|
|
|
page += f"Last compiled: *{MONTHS[curtime.tm_mon]} {curtime.tm_mday}, {curtime.tm_year} {curtime.tm_hour}:{curtime.tm_min:02d} UTC*\n\n"
|
2023-05-21 14:24:54 +00:00
|
|
|
|
2023-05-21 17:23:39 +00:00
|
|
|
print(page_metadata + wrap_page(page))
|