diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-06-09 11:28:11 +0100 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-06-09 11:28:11 +0100 |
commit | 08fe9f739dcf1570ce0321db979a410fe61ebd60 (patch) | |
tree | 05b98e7f6036682d86be2f66873a1807c753c8db /bin/compile-notes | |
parent | ad5dc9ae41051b5de11904620ea6f973cdf306ad (diff) | |
download | bookup-08fe9f739dcf1570ce0321db979a410fe61ebd60.tar.gz bookup-08fe9f739dcf1570ce0321db979a410fe61ebd60.tar.bz2 |
Feat: improved compilation procedures
Diffstat (limited to 'bin/compile-notes')
-rwxr-xr-x | bin/compile-notes | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/compile-notes b/bin/compile-notes new file mode 100755 index 0000000..1e55dcc --- /dev/null +++ b/bin/compile-notes @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# Book compiler +# + +# Parameters +BASENAME="`basename $0 | sed -e 's/\(.\)/\U\1/'`" +DIRNAME="`dirname $0`" +BASEDIR="$DIRNAME/.." +OUTPUT="${1:-notes}" +REVISION="$2" +DATE="$3" + +# Remove any dangling output files +rm -f $OUTPUT.md + +# Content +find content/notes -type f | grep '\.md$' | sort | while read file; do + cat $file >> $OUTPUT.md + echo "" >> $OUTPUT.md +done + +# Bibliography section +echo "# Bibliografia" >> $OUTPUT.md + +# Revision information +sed -i -e "s|%%revision%%|$REVISION|g" -e "s|%%date%%|$REVISION|g" $OUTPUT.md + +# Post-processing +if [ -e "snippets/terminology.sed" ]; then + sed -i -f snippets/terminology.sed $OUTPUT.md +fi + +# Symlink as a Bookdown source +ln -s $OUTPUT.md notes.Rmd |