diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e22129 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/dist \ No newline at end of file diff --git a/build.py b/build.py new file mode 100755 index 0000000..229a7c1 --- /dev/null +++ b/build.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import contextlib +from io import BufferedWriter, FileIO +import os +import shutil +import git +from jinja2 import Environment, FileSystemLoader + +SOURCES_DIR = "src" +DIST_DIR = "dist" + +def latest_git_commit_year() -> int: + return git.Repo(".").head.commit.authored_datetime.year + +def build_template(env: Environment, src_path: str): + rel_path = os.path.relpath(src_path, SOURCES_DIR) + dist_path = os.path.splitext(os.path.join(DIST_DIR, rel_path))[0] + + template = env.get_template(rel_path) + rendered_text = template.render(copyright_year = latest_git_commit_year()) + + with BufferedWriter(FileIO(dist_path, "wb")) as writer: + for line in rendered_text.splitlines(): + line = line.strip() + if len(line) > 0: + writer.write(line.encode()) + writer.write(b"\n") + +env = Environment( + loader=FileSystemLoader(SOURCES_DIR), + autoescape=True +) + +def main(): + with contextlib.suppress(FileNotFoundError): + shutil.rmtree(DIST_DIR) + + for root, _, files in os.walk(SOURCES_DIR): + rel_dir_path = os.path.relpath(root, SOURCES_DIR) + dist_root = os.path.join(DIST_DIR, rel_dir_path) + os.makedirs(dist_root, exist_ok=True) + + for src_name in files: + src_path = os.path.join(root, src_name) + + if src_name.endswith(".jinja"): + if not src_name.startswith("_"): + build_template(env, src_path) + + else: + dist_path = os.path.join(dist_root, src_name) + shutil.copy(src_path, dist_path) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/licenses.html b/licenses.html deleted file mode 100644 index ef9e536..0000000 --- a/licenses.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - Niklas Elsbrock – Open-Source-Lizenzen - - - - - - - -
-
-

Open-Source-Lizenzen

- -

Schriftarten:

- -

Überschriften: Metropolis

-

Public Domain (Unlicense)

- -

Text: Inter

-

- Copyright (c) 2016-2020 The Inter Project Authors.
- "Inter" is trademark of Rasmus Andersson.
- Licensed under the SIL Open Font License, Version 1.1. -

- -

Icons: Font Awesome Free

-

- Copyright (c) 2024 Fonticons, Inc.
- with Reserved Font Name: "Font Awesome".
- Licensed under the SIL Open Font License, Version 1.1. -

- -
- -

- Zurück zur Hauptseite -

-
-
- - - diff --git a/privacy.html b/privacy.html deleted file mode 100644 index 1547dba..0000000 --- a/privacy.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - Niklas Elsbrock – Datenschutz - - - - - - - -
-
-

Datenschutz

-

Verantwortlich für diese Website ist

-
- Niklas Elsbrock
- mail@nelsbrock.de -
- -

Keine Erfassung von Besucherinformationen

-

- Beim Besuch der Website unter www.nelsbrock.de werden keine - personenbezogenen Daten verarbeitet. Zugriffsprotokolle sind - deaktiviert. -

- -
- -

- Zurück zur Hauptseite -

-
-
- - - diff --git a/.well-known/openpgpkey/hu/dizb37aqa5h4skgu7jf1xjr4q71w4paq b/src/.well-known/openpgpkey/hu/dizb37aqa5h4skgu7jf1xjr4q71w4paq similarity index 100% rename from .well-known/openpgpkey/hu/dizb37aqa5h4skgu7jf1xjr4q71w4paq rename to src/.well-known/openpgpkey/hu/dizb37aqa5h4skgu7jf1xjr4q71w4paq diff --git a/.well-known/openpgpkey/policy b/src/.well-known/openpgpkey/policy similarity index 100% rename from .well-known/openpgpkey/policy rename to src/.well-known/openpgpkey/policy diff --git a/index.html b/src/_base.html.jinja similarity index 52% rename from index.html rename to src/_base.html.jinja index 4560f72..4468ff1 100644 --- a/index.html +++ b/src/_base.html.jinja @@ -1,11 +1,9 @@ - - - Niklas Elsbrock + {% block title %}{% endblock %} @@ -14,24 +12,11 @@
-
-
-

Niklas Elsbrock

-

Softwareentwickler und Informatikstudent

-
-
- -
+ {% block main %}{% endblock %}