#!/bin/bash # compiles new post into target directory rootDir='./tmp/' mdRoot='./prebild/' mPostDir='./prebuild/post/' # Right now: # no images # root pages # post pages post() { # First get the body of the document tmp=".swap" base=$(basename $1) cat 'templates/post-header.html' > $tmp pandoc $1 >> $tmp cat 'templates/post-footer.html' >> $tmp sed -i "3i ${base%.*}" $tmp # finally move this post to its proper location in the _rootDir mv $tmp "$rootDir/post/${base%.*}.html" } # Options: # -f post-file # -s stylesheet #[[ -z $# ]] && echo "./make.sh -h" && echo 'for more info' && exit 0 target="" stylesheet="" while getopts "f:h" opt; do case $opt in h) echo '-h shows this prompt' ;; f) target=$2 echo "Target post $2" ;; esac done # attempt to build the new post [[ -z $target ]] && echo 'No target' && exit 0 post $target