From e9643b8944c48f1d5d02ddb86289922a50ba70ce Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sat, 14 Feb 2026 00:29:24 +0100 Subject: [PATCH 01/10] feature: add brightspot config --- src/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config.py b/src/config.py index a87869c..edac069 100644 --- a/src/config.py +++ b/src/config.py @@ -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_brightspots = self.p_data_contents / "brightspots" self.p_data_fragenkatalog = self.p_data_questions / "fragenkatalog3b.json" self.p_data_metadata = self.p_data_questions / "metadata3b.json" From 0e9a4dceac02bc43b625094d676bc3509d4c2aef Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sat, 14 Feb 2026 00:29:52 +0100 Subject: [PATCH 02/10] feature: add brightspot rendering in question --- assets/style-course.css | 25 +++++++++++++++++++++++++ src/build.py | 3 +++ templates/html/question.html | 9 ++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/assets/style-course.css b/assets/style-course.css index 846f5e4..59a0bd0 100644 --- a/assets/style-course.css +++ b/assets/style-course.css @@ -24,6 +24,7 @@ background: #ddd; margin-top: 2em; margin-bottom: 2em; + position: relative; } .question p { padding: 0; @@ -34,6 +35,30 @@ font-weight: 600; margin: 1ex 1em 1.5ex 1em; } + +.question.has-brightspot .question-text { + margin-right: 3em; +} + +.question .question-brightspot { + position: absolute; + top: 1ex; + right: 1ex; + line-height: 0; + text-decoration: none; + color: inherit; +} + +.question .question-brightspot-icon { + width: 2em; + height: 2em; + display: block; +} + +.question .question-brightspot:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; +} .question .question-picture { max-width: 100%; margin-bottom: 1em; diff --git a/src/build.py b/src/build.py index 1e70dee..2dc6332 100644 --- a/src/build.py +++ b/src/build.py @@ -103,6 +103,8 @@ class Build: picture_question = "" alt_text_question = "" + brightspot_file = self.config.p_data_brightspots / f"{number}.md" + return question_template.render( question=question["question"], number=number, @@ -112,6 +114,7 @@ class Build: answer_pictures=answer_pictures, alt_text_answers=alt_text_answers, alt_text_question=alt_text_question, + brightspot=brightspot_file.exists(), ) def __build_question_slide(self, input): diff --git a/templates/html/question.html b/templates/html/question.html index a95851c..b8e7a92 100644 --- a/templates/html/question.html +++ b/templates/html/question.html @@ -1,4 +1,11 @@ -
+
+ {% if brightspot %} + + + + {% endif %}
{{ number }}: {{ question }}
{% if picture_question %}
{{ alt_text_question }}
From c79020e23970729c20486834c3202ee99e62f6aa Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sat, 14 Feb 2026 01:38:37 +0100 Subject: [PATCH 03/10] feature: add brightspot rendering --- build.py | 1 + src/build.py | 21 +++++++++++++++++++++ templates/html/brightspot.html | 10 ++++++++++ templates/html/brightspot_question.html | 17 +++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 templates/html/brightspot.html create mode 100644 templates/html/brightspot_question.html 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 @@ + diff --git a/templates/html/brightspot_question.html b/templates/html/brightspot_question.html new file mode 100644 index 0000000..72b8038 --- /dev/null +++ b/templates/html/brightspot_question.html @@ -0,0 +1,17 @@ +
+
{{ number }}: {{ question }}
+ {% if picture_question %} +
{{ alt_text_question }}
+ {% endif %} +
+ Richtige Lösung:
+ {% if answers[0] %} + {{ answers[0] }} + {% endif %} + {% if answer_pictures[0] %} +
{{ alt_text_answers[0] }}
+ {% endif %} +
+
+ + \ No newline at end of file From d105d9cb5a0b7b59f6555a9782e9bb6c9d8d7037 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sat, 14 Feb 2026 11:58:20 +0100 Subject: [PATCH 04/10] feature: renamed and fixed style --- assets/style-course.css | 26 ++++++++++---------------- templates/html/brightspot.html | 2 +- templates/html/question.html | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/assets/style-course.css b/assets/style-course.css index 59a0bd0..deaf658 100644 --- a/assets/style-course.css +++ b/assets/style-course.css @@ -36,28 +36,22 @@ margin: 1ex 1em 1.5ex 1em; } -.question.has-brightspot .question-text { - margin-right: 3em; +.question .question-brightspot { + float: right; + margin: 0 0 0.5ex 1em; } -.question .question-brightspot { - position: absolute; - top: 1ex; - right: 1ex; - line-height: 0; - text-decoration: none; - color: inherit; +.question .question-text::after { + content: ""; + display: block; + clear: right; } .question .question-brightspot-icon { - width: 2em; - height: 2em; + width: 1em; + height: 1em; display: block; -} - -.question .question-brightspot:focus-visible { - outline: 2px solid currentColor; - outline-offset: 2px; + margin-right: 0.35em; } .question .question-picture { max-width: 100%; diff --git a/templates/html/brightspot.html b/templates/html/brightspot.html index 328a52d..6667820 100644 --- a/templates/html/brightspot.html +++ b/templates/html/brightspot.html @@ -3,7 +3,7 @@ - Lichtblick: {{number}} + Lösungsweg: {{number}} {{content}} diff --git a/templates/html/question.html b/templates/html/question.html index b8e7a92..6871281 100644 --- a/templates/html/question.html +++ b/templates/html/question.html @@ -1,12 +1,15 @@
- {% if brightspot %} - - - - {% endif %} -
{{ number }}: {{ question }}
+
+ {% if brightspot %} + + + Lösungsweg + + {% endif %} + {{ number }}: {{ question }} +
{% if picture_question %}
{{ alt_text_question }}
{% endif %} From 6b5189d2c468e14c48030996b51f8c5adf6cfd4d Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sat, 14 Feb 2026 17:04:39 +0100 Subject: [PATCH 05/10] refactor: question layout --- templates/html/brightspot_question.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/templates/html/brightspot_question.html b/templates/html/brightspot_question.html index 72b8038..cdcad9c 100644 --- a/templates/html/brightspot_question.html +++ b/templates/html/brightspot_question.html @@ -3,13 +3,18 @@ {% if picture_question %}
{{ alt_text_question }}
{% endif %} -
- Richtige Lösung:
+
{% if answers[0] %} - {{ answers[0] }} + Richtig: {{ answers[0] }}
+ Falsch: {{ answers[1] }}
+ Falsch: {{ answers[2] }}
+ Falsch: {{ answers[3] }}
{% endif %} {% if answer_pictures[0] %} -
{{ alt_text_answers[0] }}
+ Richtig:
{{ alt_text_answers[0] }}

+ Falsch:
{{ alt_text_answers[1] }}

+ Falsch:
{{ alt_text_answers[2] }}

+ Falsch:
{{ alt_text_answers[3] }}

{% endif %}
From 0b30a7a41d83b649da148a0b0317d3d8a0cd0989 Mon Sep 17 00:00:00 2001 From: Tim Grelka Date: Sat, 14 Feb 2026 23:08:48 +0100 Subject: [PATCH 06/10] feat: improve styling for solutions --- assets/style-course.css | 12 ++++++------ src/build.py | 19 ++++++++++--------- templates/html/brightspot.html | 12 +++++++++--- templates/html/brightspot_question.html | 4 ++-- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/assets/style-course.css b/assets/style-course.css index deaf658..f89075a 100644 --- a/assets/style-course.css +++ b/assets/style-course.css @@ -19,7 +19,7 @@ font-style: italic; } -.question { +.question:not(.for-solution) { padding: 1ex; background: #ddd; margin-top: 2em; @@ -190,7 +190,7 @@ td { } ul { - list-style-type: square; + list-style-type: square; } ul li::marker { @@ -438,15 +438,15 @@ span.formula { /* Enable Line Breaks in Equations ... */ .course .katex-display > .katex { - white-space: normal + white-space: normal; } /* Add space between broken lines: */ .course .katex-display .base { - margin: 0.5em 0em + margin: 0.5em 0em; } /* Compensate by reducing space around display math */ .course .katex-display { - margin: 1em 0em; -} \ No newline at end of file + margin: 1em 0em; +} diff --git a/src/build.py b/src/build.py index cbe2c9d..8a88c84 100644 --- a/src/build.py +++ b/src/build.py @@ -1,4 +1,3 @@ -import functools import json import random import shutil @@ -461,16 +460,18 @@ class Build: 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", - ), + 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( + brightspot_file.stem, template_file="html/brightspot_question.html" + ) 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) + solution = renderer.render(Document(content)) + page = brightspot_template.render( + question=question, solution=solution, number=brightspot_file.stem + ) + page = self.__build_page(page, course_wrapper=False) + file.write(page) diff --git a/templates/html/brightspot.html b/templates/html/brightspot.html index 6667820..aecae60 100644 --- a/templates/html/brightspot.html +++ b/templates/html/brightspot.html @@ -1,10 +1,16 @@ - \ No newline at end of file From 77371fb3641d183547ad88c985861c7fc2841a91 Mon Sep 17 00:00:00 2001 From: Tim Grelka Date: Sun, 15 Feb 2026 13:17:27 +0100 Subject: [PATCH 07/10] fix: move button outside of question --- assets/style-course.css | 16 ++++----- templates/html/question.html | 68 +++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/assets/style-course.css b/assets/style-course.css index f89075a..03b1830 100644 --- a/assets/style-course.css +++ b/assets/style-course.css @@ -36,23 +36,19 @@ margin: 1ex 1em 1.5ex 1em; } -.question .question-brightspot { - float: right; - margin: 0 0 0.5ex 1em; +.solution { + margin-top: -1.5em; + margin-bottom: 1em; + text-align: end; } -.question .question-text::after { - content: ""; - display: block; - clear: right; -} - -.question .question-brightspot-icon { +.solution .solution-icon { width: 1em; height: 1em; display: block; margin-right: 0.35em; } + .question .question-picture { max-width: 100%; margin-bottom: 1em; diff --git a/templates/html/question.html b/templates/html/question.html index 6871281..d92af5a 100644 --- a/templates/html/question.html +++ b/templates/html/question.html @@ -1,35 +1,37 @@ -
-
- {% if brightspot %} - - - Lösungsweg - - {% endif %} - {{ number }}: {{ question }} -
- {% if picture_question %} -
{{ alt_text_question }}
- {% endif %} -
- {% for i in range(4) %} - - {% endfor %} -
+
+
+ {{ number }}: {{ question }}
- + {% if picture_question %} +
{{ alt_text_question }}
+ {% endif %} +
+ {% for i in range(4) %} + + {% endfor %} +
+
+
+ {% if solution %} + + + Lösungsweg anzeigen + + {% endif %} +
+ \ No newline at end of file From 3302eed760aad0213b1f90eb4717da08185b4e81 Mon Sep 17 00:00:00 2001 From: Tim Grelka Date: Sun, 15 Feb 2026 13:17:37 +0100 Subject: [PATCH 08/10] refactor: rename brightspots to solution --- build.py | 14 ++++++------ src/build.py | 20 ++++++++--------- src/config.py | 2 +- templates/html/brightspot_question.html | 22 ------------------- .../html/{brightspot.html => solution.html} | 0 templates/html/solution_question.html | 21 ++++++++++++++++++ 6 files changed, 38 insertions(+), 41 deletions(-) delete mode 100644 templates/html/brightspot_question.html rename templates/html/{brightspot.html => solution.html} (100%) create mode 100644 templates/html/solution_question.html diff --git a/build.py b/build.py index ae82066..e364d8b 100644 --- a/build.py +++ b/build.py @@ -6,11 +6,11 @@ conf = config.Config() # Build Everything: bd = build.Build(conf) bd.build_website() -bd.build_edition("N") -bd.build_edition("E") -bd.build_edition("A") -bd.build_edition("NE") -bd.build_edition("EA") -bd.build_edition("NEA") +# bd.build_edition("N") +# bd.build_edition("E") +# bd.build_edition("A") +# bd.build_edition("NE") +# bd.build_edition("EA") +# bd.build_edition("NEA") bd.build_assets() -bd.build_brightspots() +bd.build_solutions() diff --git a/src/build.py b/src/build.py index 8a88c84..ad1f8a4 100644 --- a/src/build.py +++ b/src/build.py @@ -103,7 +103,7 @@ class Build: picture_question = "" alt_text_question = "" - brightspot_file = self.config.p_data_brightspots / f"{number}.md" + solution_file = self.config.p_data_solutions / f"{number}.md" return question_template.render( question=question["question"], @@ -114,7 +114,7 @@ class Build: answer_pictures=answer_pictures, alt_text_answers=alt_text_answers, alt_text_question=alt_text_question, - brightspot=brightspot_file.exists(), + has_solution=solution_file.exists(), ) def __build_question_slide(self, input): @@ -454,11 +454,11 @@ class Build: 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: + 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"{brightspot_file.stem}.html").open("w") as file: + 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, @@ -466,12 +466,10 @@ class Build: include_handler=self.__include_handler, ) as renderer: question = self.__build_question( - brightspot_file.stem, template_file="html/brightspot_question.html" + solution_file.stem, template_file="html/solution_question.html" ) - brightspot_template = self.env.get_template("html/brightspot.html") + solution_template = self.env.get_template("html/solution.html") solution = renderer.render(Document(content)) - page = brightspot_template.render( - question=question, solution=solution, number=brightspot_file.stem - ) + page = solution_template.render(question=question, solution=solution, number=solution_file.stem) page = self.__build_page(page, course_wrapper=False) file.write(page) diff --git a/src/config.py b/src/config.py index edac069..81433f3 100644 --- a/src/config.py +++ b/src/config.py @@ -26,7 +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_brightspots = self.p_data_contents / "brightspots" + 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" diff --git a/templates/html/brightspot_question.html b/templates/html/brightspot_question.html deleted file mode 100644 index 931eaee..0000000 --- a/templates/html/brightspot_question.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
{{ number }}: {{ question }}
- {% if picture_question %} -
{{ alt_text_question }}
- {% endif %} -
- {% if answers[0] %} - Richtig: {{ answers[0] }}
- Falsch: {{ answers[1] }}
- Falsch: {{ answers[2] }}
- Falsch: {{ answers[3] }}
- {% endif %} - {% if answer_pictures[0] %} - Richtig:
{{ alt_text_answers[0] }}

- Falsch:
{{ alt_text_answers[1] }}

- Falsch:
{{ alt_text_answers[2] }}

- Falsch:
{{ alt_text_answers[3] }}

- {% endif %} -
-
- - \ No newline at end of file diff --git a/templates/html/brightspot.html b/templates/html/solution.html similarity index 100% rename from templates/html/brightspot.html rename to templates/html/solution.html diff --git a/templates/html/solution_question.html b/templates/html/solution_question.html new file mode 100644 index 0000000..409d67c --- /dev/null +++ b/templates/html/solution_question.html @@ -0,0 +1,21 @@ +
+
Frage: {{ question }}
+ {% if picture_question %} +
{{ alt_text_question }}
+ {% endif %} +
+ {% for i in range(1) %} +
+ {{ 'Lösung:' if i == 0 else 'Falsch:' }} + {% if answers[i] %} + {{ answers[i] }} + {% endif %} + {% if answer_pictures[i] %} +
{{ alt_text_answers[i] }}
+ {% endif %} +
+ {% endfor %} +
+
+ + \ No newline at end of file From 16208eee22fe08d613b456ff6a386d73a35bf21c Mon Sep 17 00:00:00 2001 From: Tim Grelka Date: Sun, 15 Feb 2026 13:20:17 +0100 Subject: [PATCH 09/10] fix: use has_solution parameter --- templates/html/question.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/html/question.html b/templates/html/question.html index d92af5a..bb613b8 100644 --- a/templates/html/question.html +++ b/templates/html/question.html @@ -24,7 +24,7 @@