#!/bin/bash # blog-gen # created by ~knuxify # usage: ./gen.sh mdfile # provide no mdfile to generate page cat templates/blog-header.html > index-tmp.html echo "" >> index-tmp.html [[ "$*" ]] && [[ -e "$*" ]] && { pandoc "$*" -o newarticle.html file="articles/$(head -n1 $* | sed "s/\#\ //" | sed "s/\ /-/g" | sed "s/\,/-/g" | sed "s/\./-/g" | sed "s/\:/-/g" | sed "s/\;/-/g" | tr "A-Z" "a-z" ).html" head -n5 newarticle.html > tmpart.html echo "Read more...
" >> tmpart.html cat homearticles.html >> tmpart.html mv tmpart.html homearticles.html cat templates/article-header.html > "$file" echo "" >> "$file" cat newarticle.html >> "$file" cat templates/article-footer.html >> "$file" rm newarticle.html } cat homearticles.html >> index-tmp.html cat templates/blog-footer.html >> index-tmp.html mv index-tmp.html index.html