steve0greatness,
created on Monday, 22 January 2024, 00:02:43 (1705881763),
received on Monday, 6 May 2024, 02:55:35 (1714964135)
Author identity: Steve0Greatness <75220768+Steve0Greatness@users.noreply.github.com>
dfc58d693116b031edceaeb06c57d127351e3091
build.py
@@ -68,6 +68,8 @@ def GetBlogList():
if "updated" in Item: Item["atom-update-time"] = PostDateToDateObj(Item["updated"]).strftime("%Y-%m-%d") + "T00:00:00Z" Item["pathname"] = slug.replace(".md", ".html") Item["plaintext"] = slug.replace(".md", ".txt") Item["origin"] = slugPosts.append(Item) PostsByDate = sorted(Posts, key=PostSortHelper, reverse=True) return PostsByDate
dev-server.py
@@ -1,4 +1,4 @@
from build import main as BuildStaticSitefrom build import main as BuildStaticSite, PostListfrom flask import Flask, redirect app = Flask(__name__)
@@ -7,6 +7,22 @@ app = Flask(__name__)
def Index(): return """<a href="/build">Rebuild site</a>""" @app.route("/blog-list") def Writer(): BlogListHTML = "<br/>".join(("<a href=\"/edit/%s\">%s</a>" % (post["origin"], post["title"]) for post in PostList)) return """<a href="/new-post">+</a><hr/>%(listing)s""" % { "listing": BlogListHTML } @app.route("/edit/<post>") def Editor(post: str): BlogListDict = { PostObj["origin"]: PostObj for PostObj in PostList } if post not in BlogListDict: return redirect("/") return """""" @app.route("/new-post") def NewPost(): return """""" @app.route("/build") def Builder(): BuildStaticSite()