diff options
author | Blaise Thompson <blaise@untzag.com> | 2020-12-08 20:04:08 -0600 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2020-12-08 20:04:08 -0600 |
commit | 6f26b933e68a7b209a1f32af61103fd2f552a3e8 (patch) | |
tree | f0d58112c524d28e61df9d115c1ff5b5d02c8b41 /build.py | |
parent | 860fce03cf1efccca8fe6378b952dc4bde51d31e (diff) |
mug-holder
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1,4 +1,5 @@ import os +import shutil import jinja2 import markdown import pathlib @@ -33,6 +34,8 @@ posts = [] for post in os.listdir(__here__ / "posts"): if len(post) < 3: continue + if not post.endswith(".md"): + continue with open(__here__ / "posts" / post, "r") as f: content = md.convert(f.read()) kwargs = dict() @@ -52,6 +55,9 @@ if not os.path.isdir(__here__ / "public"): os.mkdir(__here__ / "public") +shutil.copytree("posts", "public", dirs_exist_ok=True) + + template = env.get_template("index.html") with open(__here__ / "public" / "index.html", "w") as f: f.write(template.render(posts=posts, title="blog", date=date)) |