clean up script

pull/207/head
Simon Knott 2019-05-12 11:12:18 +02:00
parent 2abd9fd008
commit dd9e593b27
No known key found for this signature in database
GPG Key ID: 9F980AECBE437129
1 changed files with 14 additions and 15 deletions

View File

@ -1,9 +1,18 @@
#! /usr/bin/env sh
generate_with_solutions () {
echo "Generating English with solutions"
generate_from_stdin() {
outfile=$1
language=$2
tmpfile=$(mktemp /tmp/sytem-design-primer-epub-generator)
echo "Generating '$language' ..."
pandoc --metadata-file=epub-metadata.yaml --metadata=lang:$2 --from=markdown -o $1 <&0
echo "Done! You can find the '$language' book at ./$outfile"
}
generate_with_solutions () {
tmpfile=$(mktemp /tmp/sytem-design-primer-epub-generator.XXX)
cat ./README.md >> $tmpfile
@ -13,26 +22,16 @@ generate_with_solutions () {
: [[ -d "$dir" ]] && ( cd "$dir" && cat ./README.md >> $tmpfile && echo "" >> $tmpfile )
done
cat $tmpfile | pandoc --metadata-file=epub-metadata.yaml --metadata=lang:en --from=markdown -o README.epub
cat $tmpfile | generate_from_stdin 'README.epub' 'en'
rm "$tmpfile"
echo "Done! You can find the book at ./README.epub"
}
generate () {
name=$1
language=$2
echo "Generating Ebook $name ..."
pandoc \
--metadata-file=epub-metadata.yaml \
--metadata=lang:$language \
-o $name.epub \
$name.md
echo "Done! You can find the book at ./$name.epub"
cat $name.md | generate_from_stdin $name.epub $language
}
generate_with_solutions