@ -23,7 +23,7 @@ makeIntro(){
# We delete tmp each time the build script runs, so if the file exists, we have already generated one this time
[ -f " $output " ] && return 1
mkdir -p " ${ output %/* } "
local info = " $( sed -n '/---/,/---/p' " $file " | sed '/^$/,$d' | sed '/^---$/d' ) "
local info = " $( sed -n '/---/,/---/p' " $file " | sed '/^$/,$d' | sed -n '1,/---/p' | sed '/^---$/d' ) "
local slug = $( getBlogSlug " $file " )
local date = " $( echo " $info " | yq -r .date) "
local tags = " $( echo " $info " | yq -r 'if ( .tags | type ) == "array" then .tags else [ .tags ] end | join("\n")' | awk '{print "<li>" $0 "</li>"}' ) "
@ -54,7 +54,7 @@ index(){
local template = " $( echo "" | pandoc --template= templates/blog.html -f markdown -t html5 -M frontpage 2> /dev/null ) "
# First loop makes all the intros needed and stores them in tmp/intros
find content/blog/ -type f -name '*.md' | sort -r | head -n 1 0 | while read file; do
find content/blog/ -type f -name '*.md' | grep -v 'xxx' | sort -r | head -n 2 0 | while read file; do
makeIntro " $file " &
done
wait
@ -62,7 +62,7 @@ index(){
# Once they are created, we will put them in, in order
(
echo " $template " | sed -n '1,/#CONTENT#/p' | head -n -1
find content/blog/ -type f -name '*.md' | sort -r | head -n 1 0 | while read file; do
find content/blog/ -type f -name '*.md' | grep -v 'xxx' | sort -r | head -n 2 0 | while read file; do
grep -Eq '^draft: true' " $file " || getIntro " $file "
done
echo " $template " | sed -n '/#CONTENT#/,$p' | sed '1d'
@ -76,7 +76,7 @@ tagIndex(){
[ ! -f "tmp/templates/tagList.html" ] && echo "No taglist file" | tee "tmp/templates/tagList.html" > /dev/stderr
local template = " $( echo "" | pandoc --template= templates/blog.html -f markdown -t html5 -M archive -M title:" $title Archive " 2> /dev/null ) "
cat " $1 " | sort -r | while read file; do
cat " $1 " | grep -v 'xxx' | sort -r | while read file; do
makeIntro " $file " &
done
wait
@ -94,7 +94,7 @@ html_tag_list(){
echo "<ul class='taglist'>"
wc -l tmp/tag/* | head -n -1 | sort -nr | while read line; do
local link = $( echo " $line " | awk '{print $2 ".html"}' | sed 's/^tmp//' | tr '[A-Z]' '[a-z]' | tr ' ' '-' )
local name = $( echo " $line " | sed 's/tmp\/tag\///' | awk '{print $2 " (" $1 ")"}' )
local name = $( echo " $line " | sed 's/tmp\/tag\///' | awk '{print $2 " (" $1 ")"}' | tr '_' ' ' )
echo " <li><a href=' $link '> $name </a></li> "
done
echo "</ul>"
@ -110,8 +110,9 @@ tags(){
# Loops through each blog and puts it in tag lists, although only blogs that have changed
local newer = ""
[ -f tmp/lastTagUpdate ] && newer = "-newer tmp/lastTagUpdate"
find content/blog/ -type f -name '*.md' $newer | while read file; do
sed -n '/---/,/---/p' " $file " | sed '/^---$/d' | sed '/^$/,$d' | yq -r 'if ( .tags | type ) == "array" then .tags else [ .tags ] end | join("\n")' | while read tag; do
find content/blog/ -type f -name '*.md' -not -name 'xxx-*' $newer | while read file; do
sed -n '/---/,/---/p' " $file " | sed -n '1,/---/p' | sed '/^---$/d' | sed '/^$/,$d' | yq -r 'if ( .tags | type ) == "array" then .tags else [ .tags ] end | join("\n")' | while read tag; do
tag = $( echo " $tag " | tr ' ' '_' )
# Adds the file to the tags list if it's not already in there
grep -q " $file " tmp/tag/" $tag " 2> /dev/null || echo " $file " >> tmp/tag/" $tag "
done
@ -131,6 +132,11 @@ tags(){
touch tmp/lastTagUpdate
}
card( ) {
echo "Generating Card"
content/card.curl > public_html/card
}
clean( ) {
rm -rf tmp > /dev/null 2> /dev/null
@ -149,5 +155,6 @@ case "$1" in
index) index ; ;
blog) blog ; ;
tags) tags ; ;
all) tags && blog && index ; ;
card) card ; ;
all) tags && blog && index && card ; ;
esac