@@ -224,8 +226,8 @@ processdir () { makeindex () { headfile=cache/index_head.html bodyfile=cache/index_body.html - printf "${blogtitle}" > $headfile - printf "

%s

\n" $blogtitle > $bodyfile + printf '%s' "${blogtitle}" > $headfile + printf '

%s

\n' "$blogtitle" > $bodyfile if [ -f "indices/index.md" ]; then lowdown -e math indices/index.md | sed "s@INSERTBASEURL@$baseurl@g" >> $bodyfile fi @@ -244,26 +246,26 @@ maketagindex () { echo rebuilding tag $tag headfile=cache/tag_${tag}_head.html bodyfile=cache/tag_${tag}_body.html - printf "${blogtitle} - ${tag} (tag)" > $headfile - printf "

%s

\n" $blogtitle > $bodyfile - printf "

%s

\n" $tag >> $bodyfile + printf '%s - %s (tag)' "${blogtitle}" "${tag}" > $headfile + printf '

%s

\n' "${blogtitle}" > $bodyfile + printf '

%s

\n' "${tag}" >> $bodyfile if [ -f "indices/tag_${tag}.md" ]; then lowdown -e math indices/tag_${tag}.md >> $bodyfile fi echo >> $bodyfile - prefixes=`sqlite3 cache/posts.db "select distinct prefix from posts where tag = \"$tag\" order by date desc"` - for prefix in $prefixes; do - indexline $prefix >> $bodyfile + prefixes=`sqlite3 cache/posts.db "select distinct prefix from posts where tag = \"${tag}\" order by date desc"` + for prefix in ${prefixes}; do + indexline ${prefix} >> ${bodyfile} done - blog-template -h $headfile $bodyfile > cache/tag_${tag}.html - rm $headfile $bodyfile + blog-template -h ${headfile} ${bodyfile} > "cache/tag_${tag}.html" + # rm $headfile $bodyfile done } indexline () { prefix=$1 title=`sqlite3 cache/posts.db "select title from posts where prefix = \"$prefix\" limit 1"` - printf "

%s

\n" "$title" + printf '

%s

\n' "$prefix" "$title" dateandtags $prefix } @@ -275,7 +277,7 @@ done # reindex maketagindex -rm cache/dirtytags +cache/dirtytags if [ $dirty = 1 ]; then echo rebuilding index makeindex