From af97cdcd4997186fccc955b78577407604fd10ac Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Sat, 11 Apr 2020 20:20:27 -0500 Subject: instrumental software --- build.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'build.py') diff --git a/build.py b/build.py index 6afa673..d38dbcd 100755 --- a/build.py +++ b/build.py @@ -1,5 +1,4 @@ import os -from pprint import pprint import jinja2 import markdown import pathlib @@ -13,7 +12,7 @@ __here__ = pathlib.Path(__file__).resolve().parent date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') -md = markdown.Markdown(extensions=['meta']) +md = markdown.Markdown(extensions=['meta', "toc"]) env = jinja2.Environment(loader = jinja2.FileSystemLoader(str(__here__ / "templates"))) @@ -39,7 +38,6 @@ for post in os.listdir(__here__ / "posts"): kwargs["date"] = md.Meta["date"][0] kwargs["content"] = content kwargs["path"] = post[:-3] - print(kwargs) posts.append(Post(**kwargs)) posts.sort(key=lambda p: p.date, reverse=True) @@ -62,6 +60,7 @@ with open(__here__ / "public" / "index.html", "w") as f: template = env.get_template("post.html") for post in posts: + print(post.path) if not os.path.isdir(__here__ / "public" / post.path): os.mkdir(__here__ / "public" / post.path) with open(__here__ / "public" / post.path / "index.html", "w") as f: @@ -73,5 +72,5 @@ for post in posts: template = env.get_template('style.css') for d, _, _ in os.walk(__here__ / "public", topdown=False): - with open(os.path.join(d, "style.css"), 'w') as fh: - fh.write(template.render()) + with open(os.path.join(d, "style.css"), 'w') as f: + f.write(template.render()) -- cgit v1.2.3