2018-11-25 23:34:30 +00:00
|
|
|
# compiles new post into target directory
|
2018-06-22 20:19:27 +00:00
|
|
|
post() {
|
|
|
|
# check directory existence
|
|
|
|
if [ -f markdown/post/$1 ]
|
|
|
|
then
|
2018-06-23 02:44:06 +00:00
|
|
|
# compile the new post and drop it in ./post/
|
2018-06-22 20:19:27 +00:00
|
|
|
pandoc markdown/post/$1 --css bstyle.css -s -o post/${1%.*}.html
|
2018-06-25 07:10:06 +00:00
|
|
|
else
|
2018-06-23 02:44:06 +00:00
|
|
|
# error message incase file was not found
|
|
|
|
echo "File \"$1\" not found in markdown/post"
|
2018-06-22 20:19:27 +00:00
|
|
|
fi
|
|
|
|
}
|
2018-06-18 09:16:33 +00:00
|
|
|
|
2018-12-17 07:09:29 +00:00
|
|
|
updatestyle() {
|
|
|
|
# make sure that all sub styles are kept up to date with the root stylesheet
|
|
|
|
cp style.css ./page/bstyle.css
|
|
|
|
sed -i 's/./fonts/../fonts//g' ./page/bstyle.css
|
|
|
|
cp style.css ./post/bstyle.css
|
|
|
|
sed -i 's/./fonts/../fonts//g' ./post/bstyle.css
|
2018-11-25 23:34:30 +00:00
|
|
|
}
|
|
|
|
|
2018-06-22 20:19:27 +00:00
|
|
|
page() {
|
2018-06-25 05:26:19 +00:00
|
|
|
# we want to enforce maintainence of directory structure
|
2018-06-22 20:19:27 +00:00
|
|
|
if [ -f markdown/pages/$1 ]
|
|
|
|
then
|
|
|
|
pandoc markdown/pages/$1 --css bstyle.css -s -o page/${1%.*}.html
|
|
|
|
else
|
|
|
|
echo "File \"$1\" not found in markdown/pages"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-06-25 05:26:19 +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-11-25 23:34:30 +00:00
|
|
|
pandoc ./markdown/index.md --css style.css -s -o index.html # typing succs
|
2018-12-17 07:09:29 +00:00
|
|
|
# next we inject the navbar html stuff
|
|
|
|
sed -i '7r ./templates/navbar.html' index.html
|
2018-06-23 23:19:37 +00:00
|
|
|
}
|
|
|
|
|
2018-06-22 20:19:27 +00:00
|
|
|
help() {
|
2018-06-23 02:44:06 +00:00
|
|
|
case $1 in
|
|
|
|
type)
|
|
|
|
echo -e "[post, page] \n\tThe kind of page you want to add to the site"
|
|
|
|
echo "Different types result in different compilation locations"
|
|
|
|
;;
|
|
|
|
target)
|
|
|
|
echo "The file that you want to actually compile to html"
|
|
|
|
;;
|
|
|
|
flag)
|
|
|
|
echo -e "Available flags:\n\tr - rebuilds file, does not update index.html\n\tn - builds file, updates index.html"
|
|
|
|
echo -e "\t*Pages will not update index.html*"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "./make.sh type target.md flag"
|
|
|
|
esac
|
2018-06-22 20:19:27 +00:00
|
|
|
}
|
|
|
|
|
2018-11-25 23:34:30 +00:00
|
|
|
# taking function names as para
|
2018-06-22 20:19:27 +00:00
|
|
|
"$@"
|