roundabout,
created on Friday, 19 April 2024, 16:07:40 (1713542860),
received on Tuesday, 23 April 2024, 11:54:32 (1713873272)
Author identity: vlad <vlad.muntoiu@gmail.com>
ea9f252fba79b2612953789fd61afb1c83eefb94
ampoule_ssg/__init__.py
@@ -93,6 +93,7 @@ class Site:
self.build_dir = build_dir self.template_engine = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir)) self.pages = {} self.context = {}def add_page(self, location, page): if location.endswith("/"):
@@ -102,6 +103,7 @@ class Site:
def add_from_index(self, index, location, template, static=False, **kwargs): location = location.lstrip("/") # interpret it as site root, not OS root kwargs = {**self.context, **kwargs}if static: for document in index: self.pages[os.path.join(location, document.file_name)] = Static(self, document)
@@ -135,6 +137,7 @@ class Site:
class Page(str): def __new__(cls, site, template, document, **kwargs): kwargs = {**site.context, **kwargs}return site.template_engine.get_template(template).render(document=document, **kwargs)