refactor: rename brightspots to solution
This commit is contained in:
@@ -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()
|
||||
|
||||
+9
-11
@@ -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)
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<div class="question layout-{{ layout }} for-solution" 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>
|
||||
{% if answers[0] %}
|
||||
<b>Richtig:</b> {{ answers[0] }} <br/>
|
||||
<b>Falsch: </b> {{ answers[1] }} <br/>
|
||||
<b>Falsch: </b> {{ answers[2] }} <br/>
|
||||
<b>Falsch: </b> {{ answers[3] }} <br/>
|
||||
{% endif %}
|
||||
{% if answer_pictures[0] %}
|
||||
<b>Richtig:</b> <div class="question-picture"><img src="pictures/{{ answer_pictures[0] }}.svg" alt="{{ alt_text_answers[0] }}"></div><br/>
|
||||
<b>Falsch: </b> <div class="question-picture"><img src="pictures/{{ answer_pictures[1] }}.svg" alt="{{ alt_text_answers[1] }}"></div><br/>
|
||||
<b>Falsch: </b> <div class="question-picture"><img src="pictures/{{ answer_pictures[2] }}.svg" alt="{{ alt_text_answers[2] }}"></div><br/>
|
||||
<b>Falsch: </b> <div class="question-picture"><img src="pictures/{{ answer_pictures[3] }}.svg" alt="{{ alt_text_answers[3] }}"></div><br/>
|
||||
{% endif %}
|
||||
</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