diff options
Diffstat (limited to 'compile-md.sh')
-rwxr-xr-x | compile-md.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compile-md.sh b/compile-md.sh index f79f742..c02e692 100755 --- a/compile-md.sh +++ b/compile-md.sh @@ -2,18 +2,20 @@ set -ex -if [ $# -ne 3 ]; then - echo "./compile-md.sh [page|blog] [in.md] [out.html]" +if [ $# -ne 4 ]; then + echo "./compile-md.sh [page|blog] [title] [in.md] [out.html]" exit 1 fi -in=$2 -out=$3 +ptype=$1 +title=$2 +in=$3 +out=$4 -if [ $1 == "blog" ]; then +if [ $ptype == "blog" ]; then cat templates/blog-header.html > $out else - if [ $1 == "page" ]; then + if [ $ptype == "page" ]; then cat templates/page-header.html > $out else echo "Missing first parameter: [page|blog]" @@ -21,6 +23,10 @@ else fi fi +pclass=$(echo "$title" | tr [:upper:] [:lower:]) +sed -i "s/PAGE_TITLE/$title/" $out # replace title +sed -i "s/PAGE_CLASS/$pclass/" $out # replace class + markdown $in >> $out if [ $1 == "blog" ]; then |