blog/make.sh
2018-06-24 22:26:19 -07:00

62 lines
1.5 KiB
Bash
Executable File

# not only updates the post but inserts the description found in desc.md into the index.md then recompiles
# only gets called if
post() {
# check directory existence
if [ -f markdown/post/$1 ]
then
# compile the new post and drop it in ./post/
pandoc markdown/post/$1 --css bstyle.css -s -o post/${1%.*}.html
# check if we should change index's decription
if [ $2 == "new" ]
then
echo "Rebuilding index.html"
# using md file automatically cat out the header as a title
updateIndex $1
fi
else
# error message incase file was not found
echo "File \"$1\" not found in markdown/post"
fi
}
page() {
# we want to enforce maintainence of directory structure
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
}
function updateindex() {
arg1 = $1
arg2 = $2
}
# literally just updates the index file nothing else
index() {
pandoc index.md --css style.css -s -o index.html # typing succs
}
help() {
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
}
"$@"