blob: e15293e2a4a484df5b1dc196645ea3472e7ee30b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/bash
SITE_TITLE="Volpeon's Den"
target () {
if [ "${1#*.}" = "md" ]; then
echo "dist/$(echo "${1%.md}.html" | cut -sd / -f 2-)"
else
echo "dist/$(echo "$1" | cut -sd / -f 2-)"
fi
}
compile () {
TARGET=$(target "$1")
mkdir -p $(dirname "$TARGET")
pandoc "$1" \
-t html5 \
--template templates/base.html \
-o "$TARGET" \
--metadata sitetitle="$SITE_TITLE"
}
if [ -z "$1" ]; then
find content/ \
-iname "*.md" \
-type f \
| while read FILE
do
compile "$FILE"
done
else
if [ "$2" = "delete" ]; then
rm -rf $(target $1)
else
compile "$1"
fi
fi
|