Added build files to turn the bible into a book

This commit is contained in:
Dylan Araps
2018-06-20 12:24:38 +10:00
parent dbed16c54e
commit e0aadbde13
23 changed files with 1907 additions and 1 deletions

24
build.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Turn the single document bible into a book separated by chapters.
main() {
rm -rf manuscript
mkdir -p manuscript
# Split the README.md into chapters based on markers.
while IFS=$'\n' read -r line; do
[[ "$chap" ]] && chapter[$i]+="$line"$'\n'
[[ "$line" == "<!-- CHAPTER START -->" ]] && chap=1
[[ "$line" == "<!-- CHAPTER END -->" ]] && { chap=; ((i++)); }
done < README.md
# Write the chapters to separate files.
for i in "${!chapter[@]}"; do
: "${chapter[$i]/$'\n'*}"; : "${_/\# }"; : "${_,,}"
printf '%s\n' "${chapter[$i]}" > "manuscript/chapter${i}.txt"
printf '%s\n' "chapter${i}.txt" >> "manuscript/Book.txt"
done
}
main