mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 09:39:25 +01:00
update @ Tue 21 Jun 13:27:59 EEST 2022
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
parent
106c7d9e0d
commit
ef6073fcc5
2 changed files with 11 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,5 +4,5 @@ index.html
|
|||
.mypy_cache/
|
||||
.blog_history
|
||||
venv/
|
||||
*.old
|
||||
/backups/
|
||||
|
||||
|
|
13
scripts/blog
13
scripts/blog
|
@ -16,7 +16,7 @@ from html import escape as html_escape
|
|||
from shutil import rmtree
|
||||
from threading import Thread
|
||||
from timeit import default_timer as code_timer
|
||||
from typing import Dict, List, Set, Tuple
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
from warnings import filterwarnings as filter_warnings
|
||||
|
||||
from css_html_js_minify import html_minify # type: ignore
|
||||
|
@ -274,7 +274,15 @@ def new_blog(config: Dict) -> Tuple[int, Dict]:
|
|||
def build(config: Dict) -> Tuple[int, Dict]:
|
||||
"""Build, minimise and generate site"""
|
||||
|
||||
if len(config["blogs"]) < 1:
|
||||
latest_blog_id: Optional[str] = next(
|
||||
filter(
|
||||
lambda bid: bid if not config["blogs"][bid]["hidden"] else None,
|
||||
tuple(config["blogs"].keys())[::-1],
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
if not config["blogs"] or latest_blog_id is None:
|
||||
return log("Cannot build no blogs"), config
|
||||
|
||||
if os.path.isdir(config["blog-dir"]):
|
||||
|
@ -369,7 +377,6 @@ def build(config: Dict) -> Tuple[int, Dict]:
|
|||
log("Building blog index...", "INFO")
|
||||
|
||||
with open("index.html", "w") as index:
|
||||
latest_blog_id: str = tuple(config["blogs"].keys())[-1]
|
||||
lastest_blog: Dict = config["blogs"][latest_blog_id]
|
||||
lastest_blog_time: str = format_time(lastest_blog["time"])
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue