diff options
author | Blaise Thompson <blaise@untzag.com> | 2023-08-31 09:03:14 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2023-08-31 09:03:14 -0500 |
commit | 3f817bb1d08cf145303d55e29bbbe96a10fedeb4 (patch) | |
tree | 1c7dbeea971e4bbb1c135b0337445b7e2e8674fe /build.py | |
parent | e2a1f5541f66b210f13a918ce239a70b38b3d7a8 (diff) |
fence-photos
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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)) |