Add markdown aggregation script and generated aggregated.md

This commit is contained in:
2026-08-02 20:16:41 +02:00
parent 322f07265e
commit 84999a4b53
2 changed files with 5193 additions and 0 deletions
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Aggregate all dossier markdown into a single aggregated.md at repo root.
# Order: pages/*.md (index.md first, then page-NN.md numerically), then dossier.md.
set -euo pipefail
cd "$(dirname "$0")"
out=aggregated.md
: > "$out"
emit() {
printf '\n\n<!-- ===== source: %s ===== -->\n\n' "$1" >> "$out"
cat "$1" >> "$out"
}
# sort -V: 'index.md' sorts before 'page-*', page numbers sort naturally (robust to 3-digit pages)
while IFS= read -r f; do emit "$f"; done < <(ls pages/*.md | sort -V)
emit dossier.md
echo "Wrote $out$(grep -c 'source:' "$out") sources, $(wc -l < "$out") lines"