blog/make.sh
2019-04-25 15:38:39 -07:00

22 lines
465 B
Bash
Executable File

#!/bin/bash
# compiles new post into target directory
rootDir='./tmp/'
post() {
# First get the body of the document
tmp=".swap"
base=$(basename $1)
cat 'templates/post-header.html' > $tmp
pandoc $1 >> $tmp
cat 'templates/post-footer.html' >> $tmp
sed -i "3i <title>${base%.*}</title>" $tmp
# finally move this post to its proper location in the _rootDir
mv $tmp "$rootDir/post/${base%.*}.html"
rm -f $tmp
}
target=""
for file in $@;do
post $file
done