diff --git a/make.sh b/make.sh index e3a56d6..f39b3c2 100755 --- a/make.sh +++ b/make.sh @@ -1,6 +1,6 @@ #!/bin/bash # compiles new post into target directory -rootDir='./_dank/' +rootDir='./tmp/' mdRoot='./prebild/' mPostDir='./prebuild/post/' @@ -12,9 +12,14 @@ mPostDir='./prebuild/post/' post() { # First get the body of the document - body=$(pandoc $1) - cat 'templates/post-header.html' && echo $body && cat 'templates/post-footer.html' - # inject some page specific things like the title and favicon + 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: @@ -24,15 +29,10 @@ post() { target="" stylesheet="" -while getopts "f:s:h" opt; do +while getopts "f:h" opt; do case $opt in h) echo '-h shows this prompt' - echo '-s specifiy a custom stylesheet' - ;; - s) - stylesheet=$2 - echo "Stylesheet: $2" ;; f) target=$2 @@ -43,4 +43,4 @@ done # attempt to build the new post [[ -z $target ]] && echo 'No target' && exit 0 -post $target $stylesheet +post $target