aboutsummaryrefslogtreecommitdiff
path: root/server/tools/src/book_html.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-06 10:11:27 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-06 10:11:27 +0200
commitfeaeca3880f1a17ba6775137b873cee71376b884 (patch)
treee6f09450554c0ee1e6ab265f920a214316cbbb6c /server/tools/src/book_html.rs
parentd9aa659010f8ffd443133657cca6c541097cc1aa (diff)
downloadhurrycurry-feaeca3880f1a17ba6775137b873cee71376b884.tar
hurrycurry-feaeca3880f1a17ba6775137b873cee71376b884.tar.bz2
hurrycurry-feaeca3880f1a17ba6775137b873cee71376b884.tar.zst
Add table of contents
Diffstat (limited to 'server/tools/src/book_html.rs')
-rw-r--r--server/tools/src/book_html.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/tools/src/book_html.rs b/server/tools/src/book_html.rs
index 4a111538..089fc8f9 100644
--- a/server/tools/src/book_html.rs
+++ b/server/tools/src/book_html.rs
@@ -36,14 +36,14 @@ markup::define! {
title { "Recipe Book - Hurry Curry!" }
}
body {
- @for page in &book.pages {
- @PageR { data, page }
+ @for (index, page) in book.pages.iter().enumerate() {
+ @PageR { data, page, index }
}
}
}
}
- PageR<'a>(data: &'a Gamedata, page: &'a BookPage) {
- section.pagegroup {
+ PageR<'a>(index: usize, data: &'a Gamedata, page: &'a BookPage) {
+ section.pagegroup[id=format!("page{index}")] {
@match page {
BookPage::Cover => {
div.page {}
@@ -62,8 +62,12 @@ markup::define! {
div.page {}
div.page {}
}
- BookPage::Contents { .. } => {
- div.page {}
+ BookPage::Contents { table } => {
+ div.page {
+ ol { @for (label, page) in table {
+ li { a[href=format!("#page{page}")] { @MessageR { data, message: label } } }
+ }}
+ }
div.page {}
}
}