This commit is contained in:
Bel LaPointe
2024-01-09 13:52:07 -07:00
parent 93c7a325dd
commit ef93baf97c
5 changed files with 42 additions and 3 deletions

39
scrape.sh Normal file
View File

@@ -0,0 +1,39 @@
#! /bin/bash
main() (
set -ueo pipefail
if [ ! -f ./raw.md ]; then
wget -q -O ./raw.md https://raw.githubusercontent.com/ZachGoldberg/Startup-CTO-Handbook/main/StartupCTOHandbook.md
fi
rm ./src/*
printf "# Summary\n\n" > ./src/SUMMARY.md
cat ./raw.md \
| (
n=0
while read -r line; do
n=$((n+1))
depth="$(echo "$line" | grep -o '^##*')"
(
echo n=$n
echo line="$line"
echo depth=$depth
) >&2
if ((n>20)); then
break
fi
done
)
mdbook build
)
if [ "$0" == "$BASH_SOURCE" ]; then
main "$@"
ret=$?
echo ret=$? >&2
exit $ret
fi