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/'
output() {
echo "$1" >> index-alt.html
echo "$1" >> dist/index-alt.html
}
output_entrylist() {
echo "$1" >> entry_list.md
echo "$1" >> dist/entry_list.md
}
output_rss() {
echo "$1" >> rss.xml
echo "$1" >> dist/rss.xml
}
add_header() {
@ -61,18 +61,18 @@ create_entry() {
path="$9"
outpath="$(basename "$path" .md).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
title="$(grep -h '^title: ' "$path" | sed 's/title: //g')"
created=$(grep -h '^date: ' "$path" | sed 's/date: //g')
html_entry "$outpath" "$created" "$title"
rss_entry "$title" "$outpath"
rss_entry "$title" "dist/$outpath"
}
convert_static() {
path="$9"
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() {
@ -86,11 +86,10 @@ has_updates() {
}
cd /home/lucy/blog-content/
rm -f index.html
rm -f entry_list.md
rm -f rss.xml
rm -R dist/*
rsync --delete -avxt static/ dist/
add_header
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
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