blob: bd3569475b8aedd6c6a039aea3380e1d0368dbde (
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
|
#!/bin/bash
SITE_TITLE="Volpeon's Den"
target () {
if [ "${1#*.}" = "md" ]; then
echo "output/$(echo "${1%.md}.html" | cut -sd / -f 2-)"
else
echo "output/$(echo "$1" | cut -sd / -f 2-)"
fi
}
compile () {
TARGET=$(target "$1")
mkdir -p $(dirname "$TARGET")
pandoc "$1" \
-f markdown \
-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
elif [ "$2" = "delete" ]; then
rm -rf $(target $1)
else
compile "$1"
fi
|