From 95b03f64723bf895cb3165e176dca72e12eb9438 Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Fri, 26 Apr 2019 15:18:05 -0700 Subject: [PATCH] prettier tables and side bar --- make.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/make.sh b/make.sh index 9c90e14..436aa87 100755 --- a/make.sh +++ b/make.sh @@ -1,15 +1,17 @@ #!/bin/bash -# compiles new post into target directory rootDir='./tmp/' +[[ -z $rootDir/post/ ]] && mkdir -p $rootDir/post + 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 ${base%.*}" $tmp + # cat the files together + pandoc $1 | cat 'templates/post-header.html' - 'templates/post-footer.html' >> $tmp + sed -i "5i ${base%.*}" $tmp + sed -i "s///g' $tmp # finally move this post to its proper location in the _rootDir mv $tmp "$rootDir/post/${base%.*}.html" rm -f $tmp @@ -19,3 +21,11 @@ target="" for file in $@;do post $file done + +if [ -z $@ ] +then + while read line + do + post $line + done < "${1:-/dev/stdin}" +fi