diff options
| author | Daniel Micay <daniel.micay@grapheneos.org> | 2023-07-15 15:26:27 -0400 |
|---|---|---|
| committer | Daniel Micay <daniel.micay@grapheneos.org> | 2023-07-15 15:26:45 -0400 |
| commit | 8a4a08cae892399ba37a3dfcba8009d0438e4333 (patch) | |
| tree | ab430fc9b5b9a6d6c7891da7e18526f82f80c136 /process-templates.py | |
| parent | ffe32aca511f461c7b1ca52be4c9f71c515a8748 (diff) | |
run process-templates as an executable
Diffstat (limited to 'process-templates.py')
| -rw-r--r-- | process-templates.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/process-templates.py b/process-templates.py deleted file mode 100644 index 703acc74..00000000 --- a/process-templates.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/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) |
