still need styling injection as well as post metadata into final output

This commit is contained in:
Medium Fries 2019-04-24 21:43:28 -07:00
parent 1ddfe92411
commit 23b18fb97f

68
make.sh
View File

@ -1,8 +1,9 @@
#!/bin/bash
# compiles new post into target directory # compiles new post into target directory
rootDir='./_site/' rootDir='./_dank/'
mdRoot='./markdown/' mdRoot='./prebild/'
mPostDir='./markdown/post/' mPostDir='./prebuild/post/'
# Right now: # Right now:
# no images # no images
@ -10,39 +11,36 @@ mPostDir='./markdown/post/'
# post pages # post pages
post() { post() {
pandoc $mPostDir/$1 --css style.css -s -o $rootDir/post/${1%.*}.html # First get the body of the document
# TODO: do acheck for images and build if there are any images body=$(pandoc $1)
cat 'templates/post-header.html' && echo $body && cat 'templates/post-footer.html'
# inject some page specific things like the title and favicon
} }
style() { # Options:
[[ -z $1 ]] && echo 'No target given' && exit 0 # -f post-file
# Updating index style # -s stylesheet
cp style.css $rootDir/style.css #[[ -z $# ]] && echo "./make.sh -h" && echo 'for more info' && exit 0
# Updating page style target=""
cp style.css $rootDir/page/style.css stylesheet=""
while getopts "f:s:h" opt; do
# Updating post style case $opt in
cp style.css $rootDir/post/style.css h)
} echo '-h shows this prompt'
echo '-s specifiy a custom stylesheet'
root() { ;;
if [[ -z $2 ]] s)
then stylesheet=$2
pandoc $mdRootr/$1 --css style.css -s -o $rootDir/page/${1%.*}.html echo "Stylesheet: $2"
exit 0 ;;
fi f)
pandoc $mdRootr/$1 --css $2 -s -o $rootDir/${1%.*}.html target=$2
} echo "Target post $2"
;;
# taking function names as param esac
"$@" done
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
# attempt to build the new post
[[ -z $target ]] && echo 'No target' && exit 0
post $target $stylesheet