This commit is contained in:
parent
68c2886ac0
commit
c53825fed1
2 changed files with 9 additions and 6 deletions
|
@ -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",
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue