From 6feb88700a668976b1313170957d5d6da9c9a13a Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 3 Sep 2018 19:54:52 +0200 Subject: [PATCH] English version includes solutions --- generate-epub.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/generate-epub.sh b/generate-epub.sh index 1787e8a5..80a6394f 100755 --- a/generate-epub.sh +++ b/generate-epub.sh @@ -1,5 +1,25 @@ #! /usr/bin/env sh +generate_with_solutions () { + echo "Generating English with solutions" + + tmpfile=$(mktemp /tmp/abc-script.XXXXXX) + + cat ./README.md >> $tmpfile + + for dir in ./solutions/system_design/*; do + case $dir in *template*) continue;; esac + case $dir in *__init__.py*) continue;; esac + : [[ -d "$dir" ]] && ( cd "$dir" && cat ./README.md >> $tmpfile && echo "" >> $tmpfile ) + done + + cat $tmpfile | pandoc --from=markdown -o README.epub + + rm "$tmpfile" + + echo "Done! You can find the book at ./README.epub" +} + generate () { name=$1 echo "Generating Ebook $name ..." @@ -7,7 +27,7 @@ generate () { echo "Done! You can find the book at ./$name.epub" } -generate README +generate_with_solutions generate README-ja generate README-zh-Hans generate README-zh-TW