aboutsummaryrefslogtreecommitdiff
path: root/bin/compile-book
diff options
context:
space:
mode:
Diffstat (limited to 'bin/compile-book')
-rwxr-xr-xbin/compile-book13
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/compile-book b/bin/compile-book
index 2907e98..5c8447a 100755
--- a/bin/compile-book
+++ b/bin/compile-book
@@ -7,11 +7,20 @@
BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`"
DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."
-STRUCTURE="structure/book"
CONTENT="content/sections"
OUTPUT="${1:-book}"
REVISION="$2"
DATE="$3"
+LANG="`grep lang _common.yml _book.yml _notes.yml 2> /dev/null | tail -1 | cut -d : -f 3 | sed -e 's/"//g' -e 's/ //g'`"
+
+# Set the language
+if [ -z "$LANG" ]; then
+ LANG="en"
+fi
+
+# Set structure and templates
+STRUCTURE="structure/book/$LANG"
+TEMPLATES="templates/book/$LANG"
# Remove any dangling output files
rm -f $OUTPUT.md $OUTPUT.Rmd
@@ -42,7 +51,7 @@ if [ -d "$CONTENT" ]; then
find $CONTENT -type f | grep '\.md$' | sort | while read file; do
cat $file >> $OUTPUT.md
echo "" >> $OUTPUT.md
- cat $BASEDIR/templates/book/references.md >> $OUTPUT.md
+ cat $BASEDIR/$TEMPLATES/references.md >> $OUTPUT.md
echo "" >> $OUTPUT.md
done
fi