Page not found
The requested page does not exist. If you think this is a mistake, please report an issue.
diff --git a/process-static b/process-static index c3176328..7979c854 100755 --- a/process-static +++ b/process-static @@ -31,6 +31,8 @@ cp -a nginx nginx-tmp rm -rf static-tmp cp -a static static-tmp +python3 process-templates.py static-tmp + for file in static-tmp/**/*.@(json|webmanifest); do json_verify < "$file" >/dev/null json_reformat -m < "$file" | sponge "$file" diff --git a/process-templates.py b/process-templates.py new file mode 100644 index 00000000..703acc74 --- /dev/null +++ b/process-templates.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +from jinja2 import FileSystemLoader, Environment +import os +import sys + +ROOT_DIR = sys.argv[1] +TEMPLATE_PATH_LIST = [ROOT_DIR, "templates/"] + +loader = FileSystemLoader(searchpath=TEMPLATE_PATH_LIST) +environment = Environment(loader=loader, autoescape=True) + +template_file_list = [] +for dirpath, dirnames, filenames in os.walk(ROOT_DIR): + for filename in filenames: + if filename.endswith(".html"): + template_file_list.append( + (os.path.join(dirpath, filename)).split(sep=os.path.sep, maxsplit=1)[1] + ) + +for template_file in template_file_list: + template = environment.get_template(template_file) + rendered_template = template.render() + path = os.path.join(ROOT_DIR, template_file) + with open(path, mode="w") as f: + f.write(rendered_template) diff --git a/static/404.html b/static/404.html index 83b3f8c1..b5127d1d 100644 --- a/static/404.html +++ b/static/404.html @@ -28,40 +28,13 @@
-The requested page does not exist. If you think this is a mistake, please report an issue.