diff --git a/make.sh b/make.sh index 26ec765..e3a56d6 100755 --- a/make.sh +++ b/make.sh @@ -1,8 +1,9 @@ +#!/bin/bash # compiles new post into target directory -rootDir='./_site/' +rootDir='./_dank/' -mdRoot='./markdown/' -mPostDir='./markdown/post/' +mdRoot='./prebild/' +mPostDir='./prebuild/post/' # Right now: # no images @@ -10,39 +11,36 @@ mPostDir='./markdown/post/' # post pages post() { - pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html - # TODO: do acheck for images and build if there are any images + # 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 } -style() { - [[ -z $1 ]] && echo 'No target given' && exit 0 - # Updating index style - cp style.css $rootDir/style.css +# Options: +# -f post-file +# -s stylesheet +#[[ -z $# ]] && echo "./make.sh -h" && echo 'for more info' && exit 0 - # Updating page style - cp style.css $rootDir/page/style.css - - # Updating post style - cp style.css $rootDir/post/style.css -} - -root() { - if [[ -z $2 ]] - then - pandoc $mdRootr/$1 --css style.css -s -o $rootDir/page/${1%.*}.html - exit 0 - fi - pandoc $mdRootr/$1 --css $2 -s -o $rootDir/${1%.*}.html -} - -# taking function names as param -"$@" - -if [ -z $1 ] -then - echo './make.sh post file.md - make new post' - echo './make.sh style - update & sync style sheets' - echo './make.sh page file.md - make new page' - echo './make.sh index - update index' -fi +target="" +stylesheet="" +while getopts "f:s: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 + echo "Target post $2" + ;; + esac +done +# attempt to build the new post +[[ -z $target ]] && echo 'No target' && exit 0 +post $target $stylesheet