diff options
Diffstat (limited to 'scripts/build_content.sh')
-rwxr-xr-x | scripts/build_content.sh | 36 |
1 files changed, 23 insertions, 13 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 | ||
13 | compile () { | 13 | handle () { |
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 | ||
24 | if [ -z "$1" ]; then | 33 | if [ -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 |
32 | elif [ "$2" = "delete" ]; then | 40 | elif [ "$2" = "delete" ]; then |
33 | rm -rf $(target $1) | 41 | TARGET=$(target "$1") |
42 | echo "[DELETE] $1 -> $TARGET" | ||
43 | rm -rf $TARGET | ||
34 | else | 44 | else |
35 | compile "$1" | 45 | handle "$1" |
36 | fi | 46 | fi |