aboutsummaryrefslogtreecommitdiff
path: root/bin/build
diff options
context:
space:
mode:
authorJoris2023-03-08 09:06:47 +0100
committerJoris2023-03-08 09:06:47 +0100
commit15562b8bcc17d590285d0442c292fbba32229e05 (patch)
tree422943ec87ee582f77fb98fc3d82d708e0cb3771 /bin/build
parentebbeae447bf4a205329d8bebb3dbe02614b64a90 (diff)
Generate public/index.html
Diffstat (limited to 'bin/build')
-rwxr-xr-xbin/build31
1 files changed, 31 insertions, 0 deletions
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 "<!doctype html>
+<html lang="fr">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width">
+<link rel="stylesheet" href="/main.css">
+<link rel="icon" href="/icon.png">
+<script src="/main.js"></script>
+
+<title>Recettes</title>
+<header>Recettes</header>" > public/index.html
+
+function section {
+ SECTION_TITLE="$1"
+ RECIPE_PATH="$2"
+
+ echo "<h1>$SECTION_TITLE</h1><ul>" >> public/index.html
+ for RECIPE in $RECIPE_PATH; do
+ TITLE=$(cat "$RECIPE" | head -n 1)
+ echo "<li><a href="${RECIPE%.md}.html">${TITLE:2}</a>" >> public/index.html
+ done
+ echo "</ul>" >> 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!"