diff --git a/src/build.py b/src/build.py index d2ef6fc..12a3c56 100644 --- a/src/build.py +++ b/src/build.py @@ -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 = '
\n' - result += f'
{content["content"]}
\n' - result += f'
{content["sidebar"]}
\n' - result += '
\n' - + result = template.render({"content": content}) with open(f"build/{page}.html", "w") as file: - result = self.__build_page(result) file.write(result) diff --git a/templates/html/html.html b/templates/html/html.html new file mode 100644 index 0000000..c11e029 --- /dev/null +++ b/templates/html/html.html @@ -0,0 +1,8 @@ +{% if content["sidebar"] == None %} +{{ content["content"] }} +{% else %} +
+
{{ content["content"] }}
+
{{ content["sidebar"] }}
+
+{% endif %} \ No newline at end of file diff --git a/templates/html/page.html b/templates/html/page.html index 5e4a6ef..bd72e97 100644 --- a/templates/html/page.html +++ b/templates/html/page.html @@ -104,7 +104,13 @@ {% endif %} + {% if course_wrapper == True %} +
+ {% endif %} {{ content }} + {% if course_wrapper == True %} +
+ {% endif %}