summaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'build.py')
-rwxr-xr-xbuild.py13
1 files changed, 7 insertions, 6 deletions
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))