From 6f26b933e68a7b209a1f32af61103fd2f552a3e8 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Tue, 8 Dec 2020 20:04:08 -0600 Subject: mug-holder --- build.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'build.py') diff --git a/build.py b/build.py index 3394180..6505dbb 100755 --- a/build.py +++ b/build.py @@ -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)) -- cgit v1.2.3