blog/make.sh
2019-03-21 19:13:12 -07:00

52 lines
1.2 KiB
Bash
Executable File

# compiles new post into target directory
rootDir='./_site/'
mPageDir='./markdown/page/'
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/
}
post() {
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
}
style() {
# Updating index style
cp style.css $rootDir/style.css
# Updating page style
cp style.css $rootDir/page/style.css
# Updating post 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
}
# 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