diff options
Diffstat (limited to 'md')
-rwxr-xr-x | md/postDeploy.sh (renamed from md/md2html.sh) | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/md/md2html.sh b/md/postDeploy.sh index d45f38d..3fb1412 100755 --- a/md/md2html.sh +++ b/md/postDeploy.sh @@ -1,11 +1,14 @@ #!/bin/bash # converts md to .tmpl.html with pandoc +# Usage: ./postDeploy.sh title_of_post.md type +# type can be 'blog' or 'projects' in my case -readonly POSTS_DIR="../../html/posts" +readonly POSTS_DIR="../html/$2" readonly POST_TEMP="POST_TEMPLATE.tmpl.html" post=$(basename "$1" .md) echo "converting $post to HTML" +echo "Outputting at '$POSTS_DIR/$post.tmpl.html'" # pandoc for md to html pandoc -f markdown-auto_identifiers -t html --template=$POST_TEMP --wrap=none -o "$POSTS_DIR/$post.tmpl.html" "$post".md @@ -14,4 +17,8 @@ pandoc -f markdown-auto_identifiers -t html --template=$POST_TEMP --wrap=none -o # sed -i "s/posts\//posts\/$post/" "$POSTS_DIR/$post.tmpl.html" # makes http & https links have target _blank and rel noopener noreferrer -perl -i -0pe 's/(<\W*a\W*[^>]*href=)(["'"'"']http[s]?:\/\/[^"'"'"'>]*["'"'"'])([^>]*>)/$1$2 target="_blank" rel="noopener noreferrer"$3/g' "$POSTS_DIR/$post.tmpl.html"
\ No newline at end of file +perl -i -0pe 's/(<\W*a\W*[^>]*href=)(["'"'"']http[s]?:\/\/[^"'"'"'>]*["'"'"'])([^>]*>)/$1$2 target="_blank" rel="noopener noreferrer"$3/g' "$POSTS_DIR/$post.tmpl.html" + +echo "moving $1 to 'deployed' folder" +mkdir -p "deployed/$post" +mv $1 "deployed/$post/$1"
\ No newline at end of file |