diff options
Diffstat (limited to 'build.py')
-rwxr-xr-x | build.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/build.py b/build.py new file mode 100755 index 0000000..d044287 --- /dev/null +++ b/build.py @@ -0,0 +1,34 @@ +import os +import shutil +import jinja2 +import markdown +import pathlib +from datetime import datetime +from dataclasses import dataclass + + +__here__ = pathlib.Path(__file__).resolve().parent + + +date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + + +md = markdown.Markdown(extensions=['meta', "toc", "extra"]) + + +env = jinja2.Environment(loader = jinja2.FileSystemLoader(str(__here__ / "templates"))) + + +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(date=date)) + + +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 f: + f.write(template.render()) |