summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_content.sh36
-rwxr-xr-xscripts/watch_content.sh3
-rwxr-xr-xscripts/watch_sass.sh3
3 files changed, 25 insertions, 17 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index bd35694..460a3fe 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -10,27 +10,37 @@ target () {
10 fi 10 fi
11} 11}
12 12
13compile () { 13handle () {
14 TARGET=$(target "$1") 14 TARGET=$(target "$1")
15 mkdir -p $(dirname "$TARGET") 15 mkdir -p $(dirname "$TARGET")
16 pandoc "$1" \ 16
17 -f markdown \ 17 if [ "${1#*.}" = "md" ]; then
18 -t html5 \ 18 echo "[COMPILE] $1 -> $TARGET"
19 --template templates/base.html \ 19
20 -o "$TARGET" \ 20 pandoc "$1" \
21 --metadata sitetitle="$SITE_TITLE" 21 -f markdown \
22 -t html5 \
23 --template templates/base.html \
24 -o "$TARGET" \
25 --metadata sitetitle="$SITE_TITLE"
26 else
27 echo "[COPY ] $1 -> $TARGET"
28
29 cp "$1" "$TARGET"
30 fi
22} 31}
23 32
24if [ -z "$1" ]; then 33if [ -z "$1" ]; then
25 find content/ \ 34 find content/ \
26 -iname "*.md" \
27 -type f \ 35 -type f \
28 | while read FILE 36 | while read FILE
29 do 37 do
30 compile "$FILE" 38 handle "$FILE"
31 done 39 done
32elif [ "$2" = "delete" ]; then 40elif [ "$2" = "delete" ]; then
33 rm -rf $(target $1) 41 TARGET=$(target "$1")
42 echo "[DELETE] $1 -> $TARGET"
43 rm -rf $TARGET
34else 44else
35 compile "$1" 45 handle "$1"
36fi 46fi
diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh
index 60f7b07..c4f55fb 100755
--- a/scripts/watch_content.sh
+++ b/scripts/watch_content.sh
@@ -1,9 +1,8 @@
1#!/bin/bash 1#!/bin/bash
2 2
3inotifywait -rme create,close_write,delete,move --format "%w%f" content \ 3inotifywait -qrme close_write,delete,move --format "%w%f" content \
4 | while read FILENAME 4 | while read FILENAME
5 do 5 do
6 printf "Change detected: %s\n" "$FILENAME"
7 if [ -f "$FILENAME" ]; then 6 if [ -f "$FILENAME" ]; then
8 scripts/build_content.sh "$FILENAME" 7 scripts/build_content.sh "$FILENAME"
9 elif [ ! -d "$FILENAME" ]; then 8 elif [ ! -d "$FILENAME" ]; then
diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh
index 97fd207..a5649e7 100755
--- a/scripts/watch_sass.sh
+++ b/scripts/watch_sass.sh
@@ -1,8 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2 2
3inotifywait -rme create,close_write,delete,move --format "%w%f" assets \ 3inotifywait -qrme close_write,delete,move --format "%w%f" assets \
4 | while read FILENAME 4 | while read FILENAME
5 do 5 do
6 printf "Change detected: %s\n" "$FILENAME"
7 scripts/build_sass.sh 6 scripts/build_sass.sh
8 done 7 done