diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-06-27 20:31:45 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-06-27 20:33:25 +0900 |
| commit | 42c21ad90626346277861471b1d6896a4e2e5058 (patch) | |
| tree | 3e356fdd3606f27ccd37310e9f9f181acc4ee235 /process-templates | |
| parent | f16ef88f9f25e1e09a2a741ba3ba4bf44b03b927 (diff) | |
treewide: build via nix
Diffstat (limited to 'process-templates')
| -rwxr-xr-x | process-templates | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/process-templates b/process-templates deleted file mode 100755 index d11a8fe8..00000000 --- a/process-templates +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -from jinja2 import FileSystemLoader, Environment -from pathlib import Path -import os -import sys - -if len(sys.argv) != 2: - print(f"Usage: {sys.argv[0]} <path>") - sys.exit(1) - -ROOT_DIR = Path(sys.argv[1]) -TEMPLATE_PATH_LIST = [ROOT_DIR, "templates/"] - -loader = FileSystemLoader(searchpath=TEMPLATE_PATH_LIST) -environment = Environment(loader=loader, autoescape=True) - -file_path_list = ROOT_DIR.glob("**/*.html") -template_file_list = [os.fspath(p.relative_to(ROOT_DIR)) for p in file_path_list] - -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) |
