summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/build_content.sh33
-rwxr-xr-xscripts/watch_content.sh10
-rwxr-xr-xscripts/watch_sass.sh4
3 files changed, 38 insertions, 9 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 4476d45..992414d 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -2,7 +2,32 @@
2 2
3SITE_TITLE="Volpeon's Den" 3SITE_TITLE="Volpeon's Den"
4 4
5find content/ \ 5target () {
6 -iname "*.md" \ 6 echo "dist/$(echo ${1%.md}.html | cut -sd / -f 2-)"
7 -type f \ 7}
8 -exec sh -c 'TARGET=dist/$(echo ${0%.md}.html | cut -sd / -f 2-); mkdir -p $(dirname $TARGET) && pandoc "${0}" -t html5 --template templates/base.html -o "$TARGET" --metadata sitetitle="$1"' {} "$SITE_TITLE" \; 8
9compile () {
10 TARGET=$(target "$1")
11 mkdir -p $(dirname "$TARGET")
12 pandoc "$1" \
13 -t html5 \
14 --template templates/base.html \
15 -o "$TARGET" \
16 --metadata sitetitle="$SITE_TITLE"
17}
18
19if [ -z "$1" ]; then
20 find content/ \
21 -iname "*.md" \
22 -type f \
23 | while read FILE
24 do
25 compile "$FILE"
26 done
27else
28 if [ "$2" = "delete" ]; then
29 rm $(target $1)
30 else
31 compile "$1"
32 fi
33fi
diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh
index d2578e1..38567dc 100755
--- a/scripts/watch_content.sh
+++ b/scripts/watch_content.sh
@@ -1,8 +1,12 @@
1#!/bin/bash 1#!/bin/bash
2 2
3inotifywait -m -e create -e close_write --format "%f" content \ 3inotifywait -rme create,close_write,delete,move --format "%f" content \
4 | while read FILENAME 4 | while read FILENAME
5 do 5 do
6 printf "Change detected: %s\n" "$FILENAME" 6 printf "Change detected: %s\n" "content/$FILENAME"
7 scripts/build_content.sh 7 if [ -f "content/$FILENAME" ]; then
8 scripts/build_content.sh "content/$FILENAME"
9 else
10 scripts/build_content.sh "content/$FILENAME" "delete"
11 fi
8 done 12 done
diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh
index e7b2952..1b99f5d 100755
--- a/scripts/watch_sass.sh
+++ b/scripts/watch_sass.sh
@@ -1,8 +1,8 @@
1#!/bin/bash 1#!/bin/bash
2 2
3inotifywait -m -e create -e close_write --format "%f" assets \ 3inotifywait -rme create,close_write,delete,move --format "%f" assets \
4 | while read FILENAME 4 | while read FILENAME
5 do 5 do
6 printf "Change detected: %s\n" "$FILENAME" 6 printf "Change detected: %s\n" "assets/$FILENAME"
7 scripts/build_sass.sh 7 scripts/build_sass.sh
8 done 8 done