From ef93baf97c88232e4475357b21b9b85077ff7954 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Tue, 9 Jan 2024 13:52:07 -0700 Subject: [PATCH] try --- .gitignore | 2 ++ book.toml | 2 +- scrape.sh | 39 +++++++++++++++++++++++++++++++++++++++ src/SUMMARY.md | 1 - src/chapter_1.md | 1 - 5 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 scrape.sh delete mode 100644 src/chapter_1.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e89ee37 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +/book diff --git a/book.toml b/book.toml index 4154529..e954b7b 100644 --- a/book.toml +++ b/book.toml @@ -1,5 +1,5 @@ [book] -authors = ["Bel LaPointe"] +authors = ["ZachGoldberg"] language = "en" multilingual = false src = "src" diff --git a/scrape.sh b/scrape.sh new file mode 100644 index 0000000..01d6091 --- /dev/null +++ b/scrape.sh @@ -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 diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 7390c82..25a519c 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -1,3 +1,2 @@ # Summary -- [Chapter 1](./chapter_1.md) diff --git a/src/chapter_1.md b/src/chapter_1.md deleted file mode 100644 index b743fda..0000000 --- a/src/chapter_1.md +++ /dev/null @@ -1 +0,0 @@ -# Chapter 1