diff --git a/build.py b/build.py index b913c57..ae82066 100644 --- a/build.py +++ b/build.py @@ -13,3 +13,4 @@ bd.build_edition("NE") bd.build_edition("EA") bd.build_edition("NEA") bd.build_assets() +bd.build_brightspots() diff --git a/src/build.py b/src/build.py index 2dc6332..cbe2c9d 100644 --- a/src/build.py +++ b/src/build.py @@ -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) diff --git a/templates/html/brightspot.html b/templates/html/brightspot.html new file mode 100644 index 0000000..328a52d --- /dev/null +++ b/templates/html/brightspot.html @@ -0,0 +1,10 @@ +