From fe7d0f722a4f30c3cb32302c574ddf4619015139 Mon Sep 17 00:00:00 2001 From: "Prof. Dr. Matthias Jung DL9MJ" Date: Sun, 1 Jun 2025 22:44:33 +0200 Subject: [PATCH] feature: build slide index --- src/build.py | 11 +++++++++++ templates/slide/slide_index.html | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 templates/slide/slide_index.html diff --git a/src/build.py b/src/build.py index d45887b..e85beee 100644 --- a/src/build.py +++ b/src/build.py @@ -221,6 +221,16 @@ class Build: result = self.__build_page(result) result = BeautifulSoup(result, "html.parser").prettify() file.write(result) + + def __build_slide_index(self, book): + template = self.env.get_template("slide/slide_index.html") + with open(f"build/{book['edition']}_slide_index.html", "w") as file: + result = template.render( + book=book, + ) + result = self.__build_page(result) + result = BeautifulSoup(result, "html.parser").prettify() + file.write(result) def build_edition(self, edition): edition = edition.upper() @@ -230,6 +240,7 @@ class Build: chapters = book["chapters"] edition_name = book["title"] self.__build_book_index(book) + self.__build_slide_index(book) for number, chapter in enumerate(tqdm(chapters, desc=f"Build Edition: {edition}"),1): next_chapter = chapters[number] if number < len(chapters) else None self.__build_chapter(edition, edition_name, number, chapter, next_chapter) diff --git a/templates/slide/slide_index.html b/templates/slide/slide_index.html new file mode 100644 index 0000000..e52dd96 --- /dev/null +++ b/templates/slide/slide_index.html @@ -0,0 +1,9 @@ +

Folien: {{ book["title"] }}

+

{{ book["abstract"] }}

+
+ {% for chapter in book["chapters"] %} + + {{loop.index}}{{ chapter["title"]}} + + {% endfor %} +
\ No newline at end of file