correct padding
All checks were successful
Publish latest version / build (push) Successful in 30s

This commit is contained in:
Mylloon 2024-11-17 15:04:38 +01:00
parent 68c2886ac0
commit c53825fed1
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 9 additions and 6 deletions

View file

@ -21,10 +21,7 @@ def index() -> str:
def linkify(s): def linkify(s):
return ".".join(titleify(s).split(".")[:-1]) return ".".join(titleify(s).split(".")[:-1])
def datify(s): posts.append((linkify(p), titleify(p), get_post_cdate(p)))
return s[:-14] + " " + s[-4:]
posts.append((linkify(p), titleify(p), datify(get_post_cdate(p))))
return render_template( return render_template(
"index.html", "index.html",

View file

@ -51,11 +51,17 @@ def get_post(filename: str) -> File | None:
return None return None
else: else:
with open(filename, "r") as reader: with open(filename, "r") as reader:
return File(reader.read(), get_post_cdate(filename)) return File(reader.read(), get_post_cdatetime(filename))
def get_post_cdatetime(filename: str) -> str:
return ctime(os_path.getmtime(filename))
def get_post_cdate(filename: str) -> str: def get_post_cdate(filename: str) -> str:
return ctime(os_path.getmtime(filename)) dt = datetime.fromtimestamp(os_path.getmtime(filename))
return dt.strftime("%a %b %d %Y")
def delete_post(filename: str) -> bool: def delete_post(filename: str) -> bool: