feature: add brightspot rendering in question

This commit is contained in:
Matthias Jung
2026-02-14 00:35:03 +01:00
parent e9643b8944
commit 0e9a4dceac
3 changed files with 36 additions and 1 deletions
+25
View File
@@ -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;
+3
View File
@@ -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):
+8 -1
View File
@@ -1,4 +1,11 @@
<div class="question layout-{{ layout }}" id="{{ number }}">
<div class="question layout-{{ layout }}{% if brightspot %} has-brightspot{% endif %}" id="{{ number }}">
{% if brightspot %}
<a class="question-brightspot" href="{{ number }}.html" aria-label="Brightspot zu Frage {{ number }}">
<svg class="question-brightspot-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" fill="currentColor" aria-hidden="true" focusable="false">
<path d="M420.9 448C428.2 425.7 442.8 405.5 459.3 388.1C492 353.7 512 307.2 512 256C512 150 426 64 320 64C214 64 128 150 128 256C128 307.2 148 353.7 180.7 388.1C197.2 405.5 211.9 425.7 219.1 448L420.8 448zM416 496L224 496L224 512C224 556.2 259.8 592 304 592L336 592C380.2 592 416 556.2 416 512L416 496zM312 176C272.2 176 240 208.2 240 248C240 261.3 229.3 272 216 272C202.7 272 192 261.3 192 248C192 181.7 245.7 128 312 128C325.3 128 336 138.7 336 152C336 165.3 325.3 176 312 176z"/>
</svg>
</a>
{% endif %}
<div class="question-text">{{ number }}: {{ question }}</div>
{% if picture_question %}
<div class="question-picture"><img src="pictures/{{ picture_question }}.svg" alt="{{ alt_text_question }}"></div>