From 15562b8bcc17d590285d0442c292fbba32229e05 Mon Sep 17 00:00:00 2001
From: Joris
Date: Wed, 8 Mar 2023 09:06:47 +0100
Subject: Generate public/index.html
---
.gitignore | 1 +
bin/build | 31 +++++++++++++++++++++++
public/index.html | 75 -------------------------------------------------------
3 files changed, 32 insertions(+), 75 deletions(-)
delete mode 100644 public/index.html
diff --git a/.gitignore b/.gitignore
index 0527340..0d0f1c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
public/recettes
+public/index.html
diff --git a/bin/build b/bin/build
index ab6db24..cf1009d 100755
--- a/bin/build
+++ b/bin/build
@@ -12,4 +12,35 @@ for RECIPE in recettes/**/*.md; do
done
+echo "Building index…"
+
+echo "
+
+
+
+
+
+
+
+
Recettes
+" > public/index.html
+
+function section {
+ SECTION_TITLE="$1"
+ RECIPE_PATH="$2"
+
+ echo "$SECTION_TITLE
" >> public/index.html
+ for RECIPE in $RECIPE_PATH; do
+ TITLE=$(cat "$RECIPE" | head -n 1)
+ echo "- ${TITLE:2}" >> public/index.html
+ done
+ echo "
" >> public/index.html
+}
+
+section "Plats" "recettes/plat/*.md"
+section "Desserts" "recettes/dessert/*.md"
+section "Pains" "recettes/pain/*.md"
+section "Nettoyage" "recettes/nettoyage/*.md"
+section "Conservation" "recettes/conservation/*.md"
+
echo "Done!"
diff --git a/public/index.html b/public/index.html
deleted file mode 100644
index 3269bc3..0000000
--- a/public/index.html
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-Recettes
-
-
-Plats
-
-
-
-Desserts
-
-
-
-Pains
-
-
-
-Nettoyage
-
-
-
-Conservation
-
-
--
cgit v1.2.3