aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-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!"