diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-06-09 14:02:35 +0100 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-06-09 14:02:35 +0100 |
commit | d7b2516b88e381fe4bfc70c6685b7c9038791f2e (patch) | |
tree | bd56ccdba51f7a3b7b57e862ff8e928cd5d0f5c6 | |
parent | 3e24bf67fdb3b0091714da7def31048582abf016 (diff) | |
download | bookup-d7b2516b88e381fe4bfc70c6685b7c9038791f2e.tar.gz bookup-d7b2516b88e381fe4bfc70c6685b7c9038791f2e.tar.bz2 |
Fix: check if content folder exists
-rwxr-xr-x | bin/compile-book | 15 | ||||
-rwxr-xr-x | bin/compile-notes | 11 |
2 files changed, 16 insertions, 10 deletions
diff --git a/bin/compile-book b/bin/compile-book index 930e673..2907e98 100755 --- a/bin/compile-book +++ b/bin/compile-book @@ -8,6 +8,7 @@ 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" @@ -37,12 +38,14 @@ for file in $BASEDIR/$STRUCTURE/00*.md; do done # Sections -find content/sections -type f | grep '\.md$' | sort | while read file; do - cat $file >> $OUTPUT.md - echo "" >> $OUTPUT.md - cat $BASEDIR/templates/book/references.md >> $OUTPUT.md - echo "" >> $OUTPUT.md -done +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 + echo "" >> $OUTPUT.md + done +fi # Footers for file in $BASEDIR/$STRUCTURE/99*.md; do diff --git a/bin/compile-notes b/bin/compile-notes index 02a9420..24c98ea 100755 --- a/bin/compile-notes +++ b/bin/compile-notes @@ -8,6 +8,7 @@ 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" @@ -37,10 +38,12 @@ for file in $BASEDIR/$STRUCTURE/00*.md; do done # Content -find content/notes -type f | grep '\.md$' | sort | while read file; do - cat $file >> $OUTPUT.md - echo "" >> $OUTPUT.md -done +if [ -d "$CONTENT" ]; then + find $CONTENT -type f | grep '\.md$' | sort | while read file; do + cat $file >> $OUTPUT.md + echo "" >> $OUTPUT.md + done +fi # Bibliography section cat $BASEDIR/templates/notes/bibliography.md >> $OUTPUT.md |