diff options
author | Joris | 2023-03-08 09:06:47 +0100 |
---|---|---|
committer | Joris | 2023-03-08 09:06:47 +0100 |
commit | 15562b8bcc17d590285d0442c292fbba32229e05 (patch) | |
tree | 422943ec87ee582f77fb98fc3d82d708e0cb3771 /bin | |
parent | ebbeae447bf4a205329d8bebb3dbe02614b64a90 (diff) |
Generate public/index.html
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/build | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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!" |