targeting new _site/ directory

This commit is contained in:
Medium Fries 2018-12-22 21:40:40 -08:00
parent 9f31a6d73e
commit a5390341ac

29
make.sh
View File

@ -1,10 +1,11 @@
# compiles new post into target directory # compiles new post into target directory
rootDir='./_site/'
post() { post() {
# check directory existence # check directory existence
if [ -f markdown/post/$1 ] if [ -f markdown/post/$1 ]
then then
# compile the new post and drop it in ./post/ # CSS file is always relative to the target html location
pandoc markdown/post/$1 --css bstyle.css -s -o post/${1%.*}.html pandoc markdown/post/$1 --css style.css -s -o post/${1%.*}.html
else else
# error message incase file was not found # error message incase file was not found
echo "File \"$1\" not found in markdown/post" echo "File \"$1\" not found in markdown/post"
@ -12,18 +13,24 @@ post() {
} }
updatestyle() { updatestyle() {
# make sure that all sub styles are kept up to date with the root stylesheet # Updating index style
cp style.css ./page/bstyle.css cp style.css $rootDir/style.css
sed -i 's/.\/fonts/..\/fonts/g' ./page/bstyle.css sed -i 's/.\/fonts/..\/fonts/g' $rootDir/style.css
cp style.css ./post/bstyle.css
sed -i 's/.\/fonts/..\/fonts/g' ./page/bstyle.css # Updating page style
cp style.css $rootDir/page/style.css
sed -i 's/.\/fonts/..\/fonts/g' $rootDir/page/style.css
# Updating post style
cp style.css $rootDir/post/style.css
sed -i 's/.\/fonts/..\/fonts/g' $rootDir/page/style.css
} }
page() { page() {
# we want to enforce maintainence of directory structure # we want to enforce maintainence of directory structure
if [ -f markdown/pages/$1 ] if [ -f markdown/pages/$1 ]
then then
pandoc markdown/pages/$1 --css bstyle.css -s -o page/${1%.*}.html pandoc markdown/pages/$1 --css style.css -s -o $rootDir/page/${1%.*}.html
else else
echo "File \"$1\" not found in markdown/pages" echo "File \"$1\" not found in markdown/pages"
fi fi
@ -32,12 +39,12 @@ page() {
# literally just updates the index file nothing else # literally just updates the index file nothing else
index() { index() {
# base index file # base index file
pandoc ./markdown/index.md --css style.css -s -o index.html # typing succs pandoc ./markdown/index.md --css style.css -s -o $rootDir/index.html # typing succs
# next we inject the navbar html stuff # next we inject the navbar html stuff
sed -i '7r ./templates/navbar.html' index.html sed -i '7r ./templates/navbar.html' $rootDir/index.html
} }
# taking function names as para # taking function names as param
"$@" "$@"
if [ -z $1 ] if [ -z $1 ]