refactor: added template for html-sites
This commit is contained in:
+2
-10
@@ -221,18 +221,10 @@ class Build:
|
|||||||
|
|
||||||
def __build_html_page(self, contents, page):
|
def __build_html_page(self, contents, page):
|
||||||
for content in contents:
|
for content in contents:
|
||||||
|
template = self.env.get_template("html.html")
|
||||||
if content["url_part"] == page:
|
if content["url_part"] == page:
|
||||||
|
result = template.render({"content": content})
|
||||||
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'
|
|
||||||
|
|
||||||
with open(f"build/{page}.html", "w") as file:
|
with open(f"build/{page}.html", "w") as file:
|
||||||
|
|
||||||
result = self.__build_page(result)
|
result = self.__build_page(result)
|
||||||
file.write(result)
|
file.write(result)
|
||||||
|
|
||||||
|
|||||||
@@ -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 %}
|
||||||
@@ -104,7 +104,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if course_wrapper == True %}
|
||||||
|
<div class="course">
|
||||||
|
{% endif %}
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
{% if course_wrapper == True %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<footer class="text-lg-start border-top border-dark mt-5 pt-3">
|
<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">
|
<div class="d-flex flex-wrap justify-content-between gap-5 mb-5">
|
||||||
|
|||||||
Reference in New Issue
Block a user