From 3f817bb1d08cf145303d55e29bbbe96a10fedeb4 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Thu, 31 Aug 2023 09:03:14 -0500 Subject: fence-photos --- build.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'build.py') diff --git a/build.py b/build.py index 13fbc73..6a62eee 100755 --- a/build.py +++ b/build.py @@ -19,6 +19,11 @@ md = markdown.Markdown(extensions=['meta', "toc", "extra"]) env = jinja2.Environment(loader = jinja2.FileSystemLoader(str(__here__ / "templates"))) +shutil.rmtree(__here__ / "public") +os.mkdir(__here__ / "public") + + + # grab posts -------------------------------------------------------------------------------------- @@ -34,9 +39,9 @@ class Post: posts = [] tags = [] for post in os.listdir(__here__ / "posts"): - if len(post) < 3: - continue if not post.endswith(".md"): + shutil.copytree(__here__ / "posts" / post, + __here__ / "public" / post) continue with open(__here__ / "posts" / post, "r") as f: content = md.convert(f.read()) @@ -58,10 +63,6 @@ tags.sort() # index ------------------------------------------------------------------------------------------- -if not os.path.isdir(__here__ / "public"): - os.mkdir(__here__ / "public") - - 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