blog/make.sh

22 lines
465 B
Bash
Raw Normal View History

#!/bin/bash
# compiles new post into target directory
2019-04-25 21:45:19 +00:00
rootDir='./tmp/'
2018-06-22 20:19:27 +00:00
post() {
# First get the body of the document
2019-04-25 21:45:19 +00:00
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"
2019-04-25 21:53:21 +00:00
rm -f $tmp
2018-06-22 20:19:27 +00:00
}
target=""
2019-04-25 21:53:21 +00:00
for file in $@;do
2019-04-25 22:38:39 +00:00
post $file
done