aboutsummaryrefslogtreecommitdiff
path: root/gen/gen_index.sh
blob: 8fb76d7adabbff0e5d5426ed3b7ad9dc7d9f6dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash

echo -e "---\ntitle: Stories From the Life of Daniel Williams\n---\n"
echo

for i in $(find md -maxdepth 1 -name "*.md" -printf '%f\n'); do
  (
    title=$(sed -n 's/^title: //p' "md/$i")
    filename="${i%.*}"
    nr="${filename%%_*}"
    printf "%s. [$title](stories/${filename}.html)\n" "${filename%%_*}"
  ) &
done | sort -n

echo "An index sorted by life lessons is available [here](life_lessons.html)"