Skip to content

Commit

Permalink
remove post temp
Browse files Browse the repository at this point in the history
  • Loading branch information
HengHuH committed Jun 5, 2024
1 parent 5dbd3da commit c00f3c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
8 changes: 2 additions & 6 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,10 @@ class Builder:
def __init__(self, site) -> None:
self._site = site

with open(os.path.join(root, "post_template.html"), "r", encoding="utf-8") as f:
self.post_temp = f.read()

with open(os.path.join(root, "page_template.html"), "r", encoding="utf-8") as f:
self.page_temp = f.read()

def build(self):
# build posts
alllinks = []
for post in sorted(
self._site.posts, key=lambda x: (x.year, x.month, x.day), reverse=True
Expand All @@ -116,8 +112,8 @@ def build(self):
os.makedirs(dirname, exist_ok=True)

with open(abspath, "w", encoding="utf-8") as f:
posthtml = self.post_temp.replace("{{post.title}}", post.title)
posthtml = posthtml.replace("{{post.content}}", post.content)
posthtml = self.page_temp.replace("{{page.title}}", post.title)
posthtml = posthtml.replace("{{page.content}}", post.content)
f.write(bs(posthtml, "html.parser").prettify())

print(f"build post: {post.addr} --- DONE")
Expand Down
16 changes: 0 additions & 16 deletions post_template.html

This file was deleted.

0 comments on commit c00f3c8

Please sign in to comment.