feature: add brightspot rendering

This commit is contained in:
Matthias Jung
2026-02-14 01:38:37 +01:00
parent 0e9a4dceac
commit c79020e239
4 changed files with 49 additions and 0 deletions
+21
View File
@@ -1,3 +1,4 @@
import functools
import json
import random
import shutil
@@ -453,3 +454,23 @@ class Build:
self.__build_course_page(snippets, "patenkarte", "patenkarte")
self.__build_html_page(contents, "pruefung")
self.__build_html_page(contents, "infos")
def build_brightspots(self):
for brightspot_file in self.config.p_data_brightspots.glob("*.md"):
with brightspot_file.open() as file:
content = file.read()
with (self.config.p_build / f"{brightspot_file.stem}.html").open("w") as file:
with FiftyOhmHtmlRenderer(
question_renderer=functools.partial(
self.__build_question,
template_file="html/brightspot_question.html",
),
picture_handler=self.__picture_handler,
photo_handler=self.__photo_handler,
include_handler=self.__include_handler,
) as renderer:
brightspot_template = self.env.get_template("html/brightspot.html")
result = renderer.render(Document(content))
result = brightspot_template.render(content=result, number=brightspot_file.stem)
result = self.__build_page(result, course_wrapper=False)
file.write(result)