44 lines
1.1 KiB
Python
Executable File
44 lines
1.1 KiB
Python
Executable File
#!/usr/bin/python3
|
|
|
|
from sys import argv, exit
|
|
from random import choice, seed
|
|
import time
|
|
|
|
from article_utils import parse_article_directory, sort_titles_by_date
|
|
from page_shares import wrap_page, ADJECTIVES, MONTHS
|
|
|
|
if len(argv) <= 1:
|
|
print("No directory was supplied")
|
|
exit(-1)
|
|
|
|
seed()
|
|
|
|
page_metadata = """Title: mjestečko
|
|
CSS: /style.css
|
|
HTML header: <meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
"""
|
|
|
|
page = f"""![](/logo.png)
|
|
|
|
Personal blog of one {choice(ADJECTIVES)} Veclav Talica.
|
|
|
|
### Articles ###
|
|
|
|
"""
|
|
|
|
artciles = parse_article_directory(argv[1])
|
|
|
|
for title in sort_titles_by_date(artciles):
|
|
article = artciles[title]
|
|
metadata = article["metadata"]
|
|
page += (
|
|
f"""[{metadata.get("Title", "No title given! What a clusterfuck!")}](/articles/{title}.html)\n\n"""
|
|
f""">{metadata.get("Brief", "")}\n\n"""
|
|
)
|
|
|
|
curtime = time.gmtime(int(time.time()))
|
|
page += f"Last compiled: *{MONTHS[curtime.tm_mon]} {curtime.tm_mday}, {curtime.tm_year} {curtime.tm_hour}:{curtime.tm_min:02d} UTC*\n\n"
|
|
|
|
print(page_metadata + wrap_page(page))
|