finally got rid of the hard coded bs things

This commit is contained in:
shockrahwow 2019-06-08 00:12:56 -07:00
parent eab7a879ad
commit e798b60c79

24
make.sh
View File

@ -4,18 +4,22 @@ targetDir='post/'
post() { post() {
tmp=".swap" tmp=".swap"
full=".fullswap"
base=$(basename $1) base=$(basename $1)
# Glue all the things # First build the content of the site
pandoc $1 | cat 'templates/post-header.html' - 'templates/post-footer.html' >> $tmp pandoc $1 | sed '3i </div>' >> $tmp
sed -i "5i <title>${base%.*}</title>" $tmp sed -i '1i <div class="header">' $tmp
sed -i "s/<img/<img class=\"pure-img\"/g" $tmp # next we glue together the header and footer
sed -i 's/<table>/<table class="pure-table">/g' $tmp cat ./templates/post-header.html $tmp ./templates/post-footer.html > $full
# turn the header into an actual header
sed -i '30i <div class="header">' $tmp
sed -i '33i </div>' $tmp
# finally move this post to its proper location in the _rootDir
mv $tmp "$rootDir/$targetDir/${base%.*}.html"
rm -f $tmp rm -f $tmp
# Title, images and tables get added/fixed here
sed -i "5i <title>${base%.*}</title>" $full
sed -i "s/<img/<img class=\"pure-img\"/g" $full
sed -i 's/<table>/<table class="pure-table">/g' $full
# finally move this post to its proper location in the _rootDir
mv $full "$rootDir/$targetDir/${base%.*}.html"
rm -f $full
} }
[[ -z $rootDir/post/ ]] && mkdir -p $rootDir/post [[ -z $rootDir/post/ ]] && mkdir -p $rootDir/post