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

echo -e "---\ntitle: All Stories\n---\n"

echo "You can also see the stories sorted by life lessons [here](/life_lessons.html)\n"

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