summaryrefslogtreecommitdiff
path: root/compile-md.sh
blob: f79f74219e21a2c414ba87744765d509620b695a (plain)
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
#!/usr/bin/env bash

set -ex

if [ $# -ne 3 ]; then
  echo "./compile-md.sh [page|blog] [in.md] [out.html]"
  exit 1
fi

in=$2
out=$3

if [ $1 == "blog" ]; then
  cat templates/blog-header.html > $out
else
  if [ $1 == "page" ]; then
    cat templates/page-header.html > $out
  else
    echo "Missing first parameter: [page|blog]"
    exit 1
  fi
fi

markdown $in >> $out

if [ $1 == "blog" ]; then
  cat templates/blog-footer.html >> $out
else
  cat templates/page-footer.html >> $out
fi

./tidy.sh $out