Merge branch 'main' into feat/cli

This commit is contained in:
Tim Grelka
2026-02-15 16:25:01 +01:00
8 changed files with 271 additions and 93 deletions
+23
View File
@@ -105,6 +105,8 @@ class Build:
picture_question = ""
alt_text_question = ""
solution_file = self.config.p_data_solutions / f"{number}.md"
return question_template.render(
question=question["question"],
number=number,
@@ -114,6 +116,7 @@ class Build:
answer_pictures=answer_pictures,
alt_text_answers=alt_text_answers,
alt_text_question=alt_text_question,
has_solution=solution_file.exists(),
)
def __build_question_slide(self, input):
@@ -474,3 +477,23 @@ class Build:
self.__build_course_page(snippets, "patenkarte", "patenkarte")
self.__build_html_page(contents, "pruefung")
self.__build_html_page(contents, "infos")
def build_solutions(self):
for solution_file in self.config.p_data_solutions.glob("*.md"):
with solution_file.open() as file:
content = file.read()
with (self.config.p_build / f"{solution_file.stem}.html").open("w") as file:
with FiftyOhmHtmlRenderer(
question_renderer=self.__build_question,
picture_handler=self.__picture_handler,
photo_handler=self.__photo_handler,
include_handler=self.__include_handler,
) as renderer:
question = self.__build_question(
solution_file.stem, template_file="html/solution_question.html"
)
solution_template = self.env.get_template("html/solution.html")
solution = renderer.render(Document(content))
page = solution_template.render(question=question, solution=solution, number=solution_file.stem)
page = self.__build_page(page, course_wrapper=False)
file.write(page)
+1
View File
@@ -26,6 +26,7 @@ class Config:
self.p_data_slides = self.p_data_contents / "slides"
self.p_data_snippets = self.p_data_contents / "snippets"
self.p_data_static = self.p_data_contents / "static"
self.p_data_solutions = self.p_data_contents / "solutions"
self.p_data_fragenkatalog = self.p_data_questions / "fragenkatalog3b.json"
self.p_data_metadata = self.p_data_questions / "metadata3b.json"