feature: build slide index

This commit is contained in:
Prof. Dr. Matthias Jung DL9MJ
2025-06-24 22:04:42 +02:00
committed by Tim Grelka
parent 42cfe5407d
commit fe7d0f722a
2 changed files with 20 additions and 0 deletions
+11
View File
@@ -222,6 +222,16 @@ class Build:
result = BeautifulSoup(result, "html.parser").prettify() result = BeautifulSoup(result, "html.parser").prettify()
file.write(result) 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): def build_edition(self, edition):
edition = edition.upper() edition = edition.upper()
@@ -230,6 +240,7 @@ class Build:
chapters = book["chapters"] chapters = book["chapters"]
edition_name = book["title"] edition_name = book["title"]
self.__build_book_index(book) self.__build_book_index(book)
self.__build_slide_index(book)
for number, chapter in enumerate(tqdm(chapters, desc=f"Build Edition: {edition}"),1): for number, chapter in enumerate(tqdm(chapters, desc=f"Build Edition: {edition}"),1):
next_chapter = chapters[number] if number < len(chapters) else None next_chapter = chapters[number] if number < len(chapters) else None
self.__build_chapter(edition, edition_name, number, chapter, next_chapter) self.__build_chapter(edition, edition_name, number, chapter, next_chapter)
+9
View File
@@ -0,0 +1,9 @@
<h1>Folien: {{ book["title"] }}</h1>
<p>{{ book["abstract"] }}</p>
<div class="chapter-toc d-grid gap-2">
{% for chapter in book["chapters"] %}
<a class="btn btn-outline-primary btn-labeled" href="{{ book["edition"] }}_slide_{{ chapter["ident"] }}.html">
<span class="btn-label">{{loop.index}}</span>{{ chapter["title"]}}
</a>
{% endfor %}
</div>