blog/make.sh

49 lines
976 B
Bash
Raw Normal View History

# compiles new post into target directory
2018-12-23 05:40:40 +00:00
rootDir='./_site/'
2019-04-24 22:31:49 +00:00
mdRoot='./markdown/'
mPostDir='./markdown/post/'
2019-04-24 22:31:49 +00:00
# Right now:
# no images
# root pages
# post pages
2018-06-22 20:19:27 +00:00
post() {
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html
2019-04-24 22:31:49 +00:00
# TODO: do acheck for images and build if there are any images
2018-06-22 20:19:27 +00:00
}
2019-01-11 20:31:47 +00:00
style() {
2019-04-24 22:31:49 +00:00
[[ -z $1 ]] && echo 'No target given' && exit 0
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
}
2019-04-24 22:31:49 +00:00
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
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