Merge pull request #87 from DARC-e-V/feature/brightspots
Feature/brightspots
This commit is contained in:
+21
-6
@@ -19,11 +19,12 @@
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.question {
|
||||
.question:not(.for-solution) {
|
||||
padding: 1ex;
|
||||
background: #ddd;
|
||||
margin-top: 2em;
|
||||
margin-bottom: 2em;
|
||||
position: relative;
|
||||
}
|
||||
.question p {
|
||||
padding: 0;
|
||||
@@ -34,6 +35,20 @@
|
||||
font-weight: 600;
|
||||
margin: 1ex 1em 1.5ex 1em;
|
||||
}
|
||||
|
||||
.solution {
|
||||
margin-top: -1.5em;
|
||||
margin-bottom: 1em;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.solution .solution-icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
display: block;
|
||||
margin-right: 0.35em;
|
||||
}
|
||||
|
||||
.question .question-picture {
|
||||
max-width: 100%;
|
||||
margin-bottom: 1em;
|
||||
@@ -171,7 +186,7 @@ td {
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: square;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
ul li::marker {
|
||||
@@ -419,15 +434,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;
|
||||
}
|
||||
margin: 1em 0em;
|
||||
}
|
||||
|
||||
@@ -13,3 +13,4 @@ bd.build_edition("NE")
|
||||
bd.build_edition("EA")
|
||||
bd.build_edition("NEA")
|
||||
bd.build_assets()
|
||||
bd.build_solutions()
|
||||
|
||||
@@ -104,6 +104,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,
|
||||
@@ -113,6 +115,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):
|
||||
@@ -458,3 +461,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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
<div class="question layout-{{ layout }}" id="{{ number }}">
|
||||
<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>
|
||||
{% endif %}
|
||||
<div class="answers">
|
||||
{% for i in range(4) %}
|
||||
<button onclick="answer(this, {{ 'true' if i == 0 else 'false' }} );">
|
||||
{% if answers[i] %}
|
||||
{{ answers[i] }}
|
||||
{% endif %}
|
||||
{% if answer_pictures[i] %}
|
||||
<div class="question-picture"><img src="pictures/{{ answer_pictures[i] }}.svg" alt="{{ alt_text_answers[i] }}"></div>
|
||||
{% endif %}
|
||||
{% if i == 0 %}
|
||||
<div class="result material-icons">check</div>
|
||||
{% else %}
|
||||
<div class="result material-icons">clear</div>
|
||||
{% endif %}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<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>
|
||||
{% endif %}
|
||||
<div class="answers">
|
||||
{% for i in range(4) %}
|
||||
<button onclick="answer(this, {{ 'true' if i == 0 else 'false' }} );">
|
||||
{% if answers[i] %}
|
||||
{{ answers[i] }}
|
||||
{% endif %}
|
||||
{% if answer_pictures[i] %}
|
||||
<div class="question-picture"><img src="pictures/{{ answer_pictures[i] }}.svg" alt="{{ alt_text_answers[i] }}"></div>
|
||||
{% endif %}
|
||||
{% if i == 0 %}
|
||||
<div class="result material-icons">check</div>
|
||||
{% else %}
|
||||
<div class="result material-icons">clear</div>
|
||||
{% endif %}
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="solution">
|
||||
{% if has_solution %}
|
||||
<a class="btn btn-warning btn-sm d-inline-flex align-items-center" href="{{ number }}.html" aria-label="Lösungshinweis zu Frage {{ number }}" title="Lösungshinweis">
|
||||
<svg class="solution-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>
|
||||
<span>Lösungsweg anzeigen</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="card" role="alert">
|
||||
<h2 class="card-header text-bg-warning bg-opacity-50">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" fill="currentColor" aria-hidden="true" focusable="false" style="width: 1.1em; height: 1.1em; vertical-align: -0.1em;">
|
||||
<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>
|
||||
Lösungsweg: {{number}}
|
||||
</h2>
|
||||
|
||||
<div class="card-body text-bg-light">
|
||||
{{question}}
|
||||
</div>
|
||||
<hr class="m-0" />
|
||||
<div class="card-body">
|
||||
{{solution}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="question layout-{{ layout }} for-solution" id="{{ number }}">
|
||||
<div class="question-text m-0">Frage: {{ question }}</div>
|
||||
{% if picture_question %}
|
||||
<div class="question-picture"><img src="pictures/{{ picture_question }}.svg" alt="{{ alt_text_question }}"></div>
|
||||
{% endif %}
|
||||
<div class="answers">
|
||||
{% for i in range(1) %}
|
||||
<div>
|
||||
<b>{{ 'Lösung:' if i == 0 else 'Falsch:' }}</b>
|
||||
{% if answers[i] %}
|
||||
{{ answers[i] }}
|
||||
{% endif %}
|
||||
{% if answer_pictures[i] %}
|
||||
<div class="question-picture"><img src="pictures/{{ answer_pictures[i] }}.svg" alt="{{ alt_text_answers[i] }}"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user