From 92ece015bf23e0d078b8798e52d10a6cdfe7010c Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Mon, 5 Jul 2021 15:42:38 -0500 Subject: refactor to build using python --- .gitignore | 1 + build.py | 34 ++++++++++++++++++++++++++ public/index.html | 51 --------------------------------------- public/style.css | 18 -------------- publicize.sh | 7 +++++- templates/footer.html | 12 ++++++++++ templates/index.html | 46 +++++++++++++++++++++++++++++++++++ templates/style.css | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 165 insertions(+), 70 deletions(-) create mode 100644 .gitignore create mode 100755 build.py delete mode 100644 public/index.html delete mode 100644 public/style.css create mode 100644 templates/footer.html create mode 100644 templates/index.html create mode 100644 templates/style.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46f5006 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +public/* 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()) diff --git a/public/index.html b/public/index.html deleted file mode 100644 index ed1fa27..0000000 --- a/public/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - blaise.zone - - - -

blaise.zone

-
-

- Welcome to Blaise Thompson's personal website!
- This page simply links to all of my public profiles & projects.
- Thanks for stopping by! —Blaise (pronoun.is/he) -

-

professional

-

- curriculum vitae
- LinkedIn
- ORCID
- Google Scholar
- Chemistry Electronics Shop
-

-

personal

-

- agenda
- blog
- memories
- Mastodon
- Steam
-

-

development

-

- GitHub
- GitLab
- PyPI
- Read the Docs
-

-

projects

-

- yaq
- WrightTools
- mechatronics
-

-
-

- CC0: no copyright -

- - diff --git a/public/style.css b/public/style.css deleted file mode 100644 index 9cff696..0000000 --- a/public/style.css +++ /dev/null @@ -1,18 +0,0 @@ -a { - text-decoration: none; - color: #81a2be; -} - -body { - font-family: 'DejaVu Sans Mono', monospace; - margin: 40px auto; - min-width: 80ch; - max-width: 80ch; - line-height: 1.5; - font-size: 16px; - background-color: #1d1f21; - color: #c5c8c6; - padding: 0 10px; - text-align: left; - overflow-y: scroll; -} diff --git a/publicize.sh b/publicize.sh index a5bb3d7..ebc5739 100755 --- a/publicize.sh +++ b/publicize.sh @@ -1 +1,6 @@ -scp -r public/* root@blaise.zone:/var/www/blaise.zone/html/ +#!/bin/bash +cd "$(dirname "$0")" +git pull +python3 build.py +cp -r ./public/* /var/www/blaise.zone/html/ + diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..10419e2 --- /dev/null +++ b/templates/footer.html @@ -0,0 +1,12 @@ +
+ +

+built {{ date }} +

+CC0: no copyright +(source) +
+

+ + + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..c27acac --- /dev/null +++ b/templates/index.html @@ -0,0 +1,46 @@ + + + + + + blaise.zone + + + +

blaise.zone

+
+

+ Welcome to Blaise Thompson's personal website!
+ This page simply links to all of my public profiles & projects.
+ Thanks for stopping by! —Blaise (pronoun.is/he) +

+

professional

+

+ curriculum vitae
+ LinkedIn
+ ORCID
+ Google Scholar
+ Chemistry Electronics Shop
+

+

personal

+

+ agenda
+ blog
+ memories
+ Mastodon
+ Steam
+

+

development

+

+ GitHub
+ GitLab
+ PyPI
+ Read the Docs
+

+

projects

+

+ yaq
+ WrightTools
+ mechatronics
+

+{% include "footer.html" %} diff --git a/templates/style.css b/templates/style.css new file mode 100644 index 0000000..9f19e42 --- /dev/null +++ b/templates/style.css @@ -0,0 +1,66 @@ +a { + text-decoration: none; + color: #81a2be; +} + +body { + font-family: 'DejaVu Sans Mono', monospace; + margin: 40px auto; + min-width: 80ch; + max-width: 80ch; + line-height: 1.5; + font-size: 16px; + background-color: #1d1f21; + color: #c5c8c6; + padding: 0 10px; + text-align: left; + overflow-y: scroll; +} + +h2 { + font-size: 16px; +} + +pre { + width: 80ch; + padding: 15px; + margin-left: auto; + margin-right: auto; + overflow: auto; + overflow-y: hidden; + font-size: 15.3px; + background: #111314; + border: 1px solid #c5c8c6; +} + +code { + background: #111314; + color: #de935f +} + +figure { + width: 100%; + margin: 0px auto; + margin-bottom: 1em; +} + +audio { + width: 100%; +} + +img { + width: 100%; +} + +table { + width: 100%; +} + +table, th, td { + border: 1px solid #969896; + border-collapse: collapse; +} + +th, td { + padding: 5px; +} -- cgit v1.2.3