From 0b30a7a41d83b649da148a0b0317d3d8a0cd0989 Mon Sep 17 00:00:00 2001 From: Tim Grelka Date: Sat, 14 Feb 2026 23:08:48 +0100 Subject: [PATCH] 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