blog/make.sh

52 lines
1.2 KiB
Bash
Raw Normal View History

# compiles new post into target directory
2018-12-23 05:40:40 +00:00
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/
}
2018-06-22 20:19:27 +00:00
post() {
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
2018-06-22 20:19:27 +00:00
}
2019-01-11 20:31:47 +00:00
style() {
2018-12-23 05:40:40 +00:00
# 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
}
2018-06-22 20:19:27 +00:00
page() {
pandoc $mPageDir/$1 --css style.css -s -o $rootDir/page/${1%.*}.html
2018-06-22 20:19:27 +00:00
}
# literally just updates the index file nothing else
2018-06-23 23:19:37 +00:00
index() {
2018-12-17 07:09:29 +00:00
# base index file
2018-12-23 05:40:40 +00:00
pandoc ./markdown/index.md --css style.css -s -o $rootDir/index.html # typing succs
2018-12-17 07:09:29 +00:00
# next we inject the navbar html stuff
2018-12-23 05:40:40 +00:00
sed -i '7r ./templates/navbar.html' $rootDir/index.html
2019-03-22 02:13:12 +00:00
# finally inject the link for the favicon
sed -i '3r ./templates/favicon.html' $rootDir/index.html
2018-06-22 20:19:27 +00:00
}
2018-12-23 05:40:40 +00:00
# taking function names as param
2018-06-22 20:19:27 +00:00
"$@"
2018-12-17 21:45:43 +00:00
if [ -z $1 ]
then
echo './make.sh post file.md - make new post'
2019-01-11 20:31:47 +00:00
echo './make.sh style - update & sync style sheets'
2018-12-17 21:45:43 +00:00
echo './make.sh page file.md - make new page'
2018-12-23 05:40:40 +00:00
echo './make.sh index - update index'
2018-12-17 21:45:43 +00:00
fi