refactor: added template for html-sites

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-06-24 22:04:14 +02:00
committed by Tim Grelka
parent 7ccff8db6f
commit 5ff5b9611f
3 changed files with 16 additions and 10 deletions
+2 -10
View File
@@ -221,18 +221,10 @@ class Build:
def __build_html_page(self, contents, page):
for content in contents:
template = self.env.get_template("html.html")
if content["url_part"] == page:
if content["sidebar"] is None:
result = content["content"]
else:
result = '<div class="fiftyohm-content-2cols">\n'
result += f'<div>{content["content"]}</div>\n'
result += f'<div>{content["sidebar"]}</div>\n'
result += '</div>\n'
result = template.render({"content": content})
with open(f"build/{page}.html", "w") as file:
result = self.__build_page(result)
file.write(result)
+8
View File
@@ -0,0 +1,8 @@
{% if content["sidebar"] == None %}
{{ content["content"] }}
{% else %}
<div class="fiftyohm-content-2cols">
<div>{{ content["content"] }}</div>
<div>{{ content["sidebar"] }}</div>
</div>
{% endif %}
+6
View File
@@ -104,7 +104,13 @@
</div>
{% endif %}
{% if course_wrapper == True %}
<div class="course">
{% endif %}
{{ content }}
{% if course_wrapper == True %}
</div>
{% endif %}
<footer class="text-lg-start border-top border-dark mt-5 pt-3">
<div class="d-flex flex-wrap justify-content-between gap-5 mb-5">