From 35a0876b9900031b60a86b2ca8dbd0b0db670974 Mon Sep 17 00:00:00 2001 From: Medium Fries Date: Wed, 24 Apr 2019 15:31:49 -0700 Subject: [PATCH] simplifying build model --- make.sh | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/make.sh b/make.sh index 3eb9f1f..26ec765 100755 --- a/make.sh +++ b/make.sh @@ -1,19 +1,21 @@ # compiles new post into target directory rootDir='./_site/' -mPageDir='./markdown/page/' +mdRoot='./markdown/' mPostDir='./markdown/post/' -img() { - # each post/page should have their own directory with the same name as that post/page - cp -r img/$1 $rootDir/img/ -} +# Right now: +# no images +# root pages +# 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 } style() { + [[ -z $1 ]] && echo 'No target given' && exit 0 # Updating index style cp style.css $rootDir/style.css @@ -24,18 +26,13 @@ style() { cp style.css $rootDir/post/style.css } -page() { - pandoc $mPageDir/$1 --css style.css -s -o $rootDir/page/${1%.*}.html -} - -# literally just updates the index file nothing else -index() { - # base index file - pandoc ./markdown/index.md --css style.css -s -o $rootDir/index.html # typing succs - # next we inject the navbar html stuff - sed -i '7r ./templates/navbar.html' $rootDir/index.html - # finally inject the link for the favicon - sed -i '3r ./templates/favicon.html' $rootDir/index.html +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