summaryrefslogtreecommitdiffstats
path: root/g2h/page.py
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-09-19 19:21:11 +0200
committerChristoph Schlosser <christoph@linux.com>2025-09-19 19:21:11 +0200
commita3324b7e71ec48daab81981e7d85967a590d4f79 (patch)
treedef4a8d901d9a56047a0e63f5f3d93803c93ee87 /g2h/page.py
parentbd403e6ab18d5cc7818e86d43c3ca0b15c5e53a1 (diff)
downloadgit2hugo-a3324b7e71ec48daab81981e7d85967a590d4f79.tar.gz
g2h: Add utility script
Also move the sources into the more conventional src/g2h dir
Diffstat (limited to 'g2h/page.py')
-rw-r--r--g2h/page.py21
1 files changed, 0 insertions, 21 deletions
diff --git a/g2h/page.py b/g2h/page.py
deleted file mode 100644
index b829a88..0000000
--- a/g2h/page.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from jinja2 import Environment, FileSystemLoader
-import os
-
-class Page:
- def __init__(self, template_file, out_dir, out_file, name, content_subdir):
- self.out_file_path = os.path.join(out_dir, out_file)
- self.name = name
- self.content_subdir = content_subdir
- template_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'templates'))
- self.template = Environment(loader=FileSystemLoader(template_dir)).get_template(template_file)
-
- def context(self):
- # TODO: Probably better to delegate to a method here so name and subdir don't have to be
- # passed around as much.
- raise NotImplementedError("Must override context")
-
- def render(self):
- content = self.template.render(self.context())
- os.makedirs(os.path.dirname(self.out_file_path), exist_ok=True)
- with open(self.out_file_path, 'w', encoding='utf-8') as f:
- f.write(content)