Add compile information to pages
It's just cool to have
It's just cool to have
by steve0greatness, Wednesday, 5 June 2024, 18:14:36 (1717611276), pushed by steve0greatness, Saturday, 8 June 2024, 03:59:12 (1717819152)
Author identity: Steve0Greatness <steve0greatnessiscool@gmail.com>
a184e2c25af4bc79047c7bc2127fe697d3e4a0f5
from re import sub as RegReplace
from typing import Literal
def GetCurTime():
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
START_TIME = GetCurTime()
DEPLOY_BUILD_DIR = {
"gh-pages-deploy": "build",
"gl-pages-deploy": "public",
PlaintextPath=post["plaintext"],
IsDraft=post["is-draft"],
OpenGraphDate=post["opengraph-date"],
post=post
post=post,
CompileTime=GetCurTime(),
SiteCompileTime=START_TIME,
ViewName="blog-post.html"
)
print("Building blog-posts/%s to %s/blog/%s" % (post["origin"], BUILD_DIRECTORY, post["pathname"]))
with open(BUILD_DIRECTORY + "/blog/" + post["pathname"], "w", encoding="utf-8") as PostHTMLFile:
Title = List["title"]
print("%s -> %s" % ("lists/" + List["filename"], BUILD_DIRECTORY + FileLocation))
with open(BUILD_DIRECTORY + FileLocation, "w") as file:
file.write(RenderTemplate("list.html", Content=List["content"], Title=Title, Location=FileLocation))
file.write(RenderTemplate(
"list.html",
Content=List["content"],
Title=Title,
Location=FileLocation,
CompileTime=GetCurTime(),
SiteCompileTime=START_TIME,
ViewName="blog-post.html"
))
ListIndex += "<li><a href=\"%s\">%s</a></li>" % (FileLocation, Title)
ListIndex += "</ul>"
print("Building list index")
with open(BUILD_DIRECTORY + "/list/index.html", "w") as file:
file.write(RenderTemplate("list-index.html", Content=ListIndex))
file.write(
RenderTemplate(
"list-index.html",
Content=ListIndex,
CompileTime="",
SiteCompileTime="",
ViewName="list-index.html"
)
)
def main():
global PostList
print("Building pages")
for file, path in PAGES.items():
AllowSitemap = file not in DISALLOWED_SITEMAP
RenderPage(file, path, AllowSitemap, PostList=PostList)
RenderPage(
file,
path,
AllowSitemap,
PostList=PostList,
CompileTime=GetCurTime(),
SiteCompileTime=START_TIME,
ViewName=file
)
print("Building redirects")
for OldLocation, NewLocation in REDIRECTS.items():
<li><a href="/list/website-sources-mirrors.html">Source Code</a></li>
<li><a href="https://steve0greatness.github.io/extras">Extras</a></li>
<li><a href="https://steve0greatness.atabook.org/">Guestbook</a></li>
<li>
<details class="inline-details">
<summary>Compile Info</summary>
<table>
<tbody>
<tr>
<th>Site Start</th>
<td>{{SiteCompileTime}}</td>
</tr>
<tr>
<th>Page Start</th>
<td>{{CompileTime}}</td>
</tr>
<tr>
<th>View Name</th>
<td>{{ViewName}}</td>
</tr>
</tbody>
</table>
</details>
</li>
</ol>
</div>
<div class="footer-link-list-holder" role="group">