alter the script so that the finished build get's built into the dist/ directory

This commit is contained in:
Lucy 2020-07-15 21:20:25 +02:00
parent 19007947b8
commit 30eff46640

View File

@ -3,15 +3,15 @@
blog_domain='https://lucy.moe/' blog_domain='https://lucy.moe/'
output() { output() {
echo "$1" >> index-alt.html echo "$1" >> dist/index-alt.html
} }
output_entrylist() { output_entrylist() {
echo "$1" >> entry_list.md echo "$1" >> dist/entry_list.md
} }
output_rss() { output_rss() {
echo "$1" >> rss.xml echo "$1" >> dist/rss.xml
} }
add_header() { add_header() {
@ -61,18 +61,18 @@ create_entry() {
path="$9" path="$9"
outpath="$(basename "$path" .md).html" outpath="$(basename "$path" .md).html"
# convert new markdown posts to html # convert new markdown posts to html
pandoc -s --css=/static/css/sakura-vader.css "$path" src/footer/footer.md -t html5 -f markdown -o "$outpath" pandoc -s --css=/css/sakura-vader.css "$path" src/footer/footer.md -t html5 -f markdown -o "dist/$outpath"
# then add it to the index # then add it to the index
title="$(grep -h '^title: ' "$path" | sed 's/title: //g')" title="$(grep -h '^title: ' "$path" | sed 's/title: //g')"
created=$(grep -h '^date: ' "$path" | sed 's/date: //g') created=$(grep -h '^date: ' "$path" | sed 's/date: //g')
html_entry "$outpath" "$created" "$title" html_entry "$outpath" "$created" "$title"
rss_entry "$title" "$outpath" rss_entry "$title" "dist/$outpath"
} }
convert_static() { convert_static() {
path="$9" path="$9"
outpath="$(basename "$path" .md).html" outpath="$(basename "$path" .md).html"
pandoc -s --css=/static/css/sakura-vader.css "$path" -t html5 -f markdown -o "$outpath" pandoc -s --css=/css/sakura-vader.css "$path" -t html5 -f markdown -o "dist/$outpath"
} }
has_updates() { has_updates() {
@ -86,11 +86,10 @@ has_updates() {
} }
cd /home/lucy/blog-content/ cd /home/lucy/blog-content/
rm -f index.html rm -R dist/*
rm -f entry_list.md rsync --delete -avxt static/ dist/
rm -f rss.xml
add_header add_header
ls -ltu src/posts/*.md | tail -n+1 | while read f; do create_entry $f; done ls -ltu src/posts/*.md | tail -n+1 | while read f; do create_entry $f; done
ls -ltu src/*.md | tail -n+1 | while read f; do convert_static $f; done ls -ltu src/*.md | tail -n+1 | while read f; do convert_static $f; done
add_footer add_footer
pandoc -s --css=/static/css/sakura-vader.css src/index/index_header.md entry_list.md src/index/after-entry-list.md src/footer/footer.md -o index.html pandoc -s --css=/css/sakura-vader.css src/index/index_header.md dist/entry_list.md src/index/after-entry-list.md src/footer/footer.md -o dist/index.html