aboutsummaryrefslogtreecommitdiff
path: root/bin/compile-notes
diff options
context:
space:
mode:
Diffstat (limited to 'bin/compile-notes')
-rwxr-xr-xbin/compile-notes13
1 files changed, 11 insertions, 2 deletions
diff --git a/bin/compile-notes b/bin/compile-notes
index 24c98ea..c56c56b 100755
--- a/bin/compile-notes
+++ b/bin/compile-notes
@@ -7,11 +7,20 @@
BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`"
DIRNAME="`dirname $0`"
BASEDIR="$DIRNAME/.."
-STRUCTURE="structure/notes"
CONTENT="content/notes"
OUTPUT="${1:-notes}"
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/notes/$LANG"
+TEMPLATES="templates/notes/$LANG"
# Remove any dangling output files
rm -f $OUTPUT.md
@@ -46,7 +55,7 @@ if [ -d "$CONTENT" ]; then
fi
# Bibliography section
-cat $BASEDIR/templates/notes/bibliography.md >> $OUTPUT.md
+cat $BASEDIR/$TEMPLATES/bibliography.md >> $OUTPUT.md
# Revision information
sed -i -e "s|%%revision%%|$REVISION|g" -e "s|%%date%%|$DATE|g" $OUTPUT.md