Skip to content

Commit

Permalink
correct a bunch of over-escaped quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
crvs committed Feb 29, 2020
1 parent c27a89f commit 05ba1ad
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/blog-make
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,20 @@ dateandtags () {
prefix="$1"
isdirty="$2"
date=`sqlite3 cache/posts.db "select date from posts where prefix = \"$prefix\" limit 1"`
echo "<div class=\"indexline-date\">"
echo '<div class="indexline-date">'
echo "<b>published: ${date}</b>"
modified=`sqlite3 cache/posts.db "select modified from posts where prefix = \"$prefix\" limit 1"`
if [ ! "$date" = "$modified" ] ; then
echo "<b>last modified: ${modified}</b>"
fi
echo "</div>"
echo "<br/>"
echo "<div class=\"indexline-tags\">"
cat << EOF
</div>
<br/>
<div class="indexline-tags">
EOF
tags=`sqlite3 cache/posts.db "select distinct tag from posts where prefix = \"$prefix\""`
for tag in $tags; do
echo "<a href=tag_${tag}.html>${tag}</a>"
printf '<a href="tag_%s.html">%s</a>' "${tag}" "${tag}"
if [ ! "$isdirty" = "" ] ; then
echo $tag >> cache/dirtytags
fi
Expand All @@ -163,8 +165,8 @@ htmlbody () {
title=`sqlite3 cache/posts.db "select distinct title from posts where prefix = \"$prefix\""`
cat << EOF
<div class="post-header">
<h1 class="blog-title"><a href=\"index.html\">${blogtitle}</a></h1>
<h1 class=\"post-title\">${title}</h1>
<h1 class="blog-title"><a href="index.html">${blogtitle}</a></h1>
<h1 class="post-title">${title}</h1>
`dateandtags $prefix "markdirty"`
</div>
<div class="post-content">
Expand Down Expand Up @@ -224,8 +226,8 @@ processdir () {
makeindex () {
headfile=cache/index_head.html
bodyfile=cache/index_body.html
printf "<title>${blogtitle}</title>" > $headfile
printf "<h1 class=\"blog-title\">%s</h1>\n" $blogtitle > $bodyfile
printf '<title>%s</title>' "${blogtitle}" > $headfile
printf '<h1 class="blog-title">%s</h1>\n' "$blogtitle" > $bodyfile
if [ -f "indices/index.md" ]; then
lowdown -e math indices/index.md | sed "s@INSERTBASEURL@$baseurl@g" >> $bodyfile
fi
Expand All @@ -244,26 +246,26 @@ maketagindex () {
echo rebuilding tag $tag
headfile=cache/tag_${tag}_head.html
bodyfile=cache/tag_${tag}_body.html
printf "<title>${blogtitle} - ${tag} (tag)</title>" > $headfile
printf "<h1 class=\"blog-title\">%s</h1>\n" $blogtitle > $bodyfile
printf "<h2 class=\"blog-title\">%s</h1>\n" $tag >> $bodyfile
printf '<title>%s - %s (tag)</title>' "${blogtitle}" "${tag}" > $headfile
printf '<h1 class="blog-title">%s</h1>\n' "${blogtitle}" > $bodyfile
printf '<h2 class="blog-title">%s</h1>\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 "<h3 class=\"indexline-title\"><a href=\"$prefix.html\">%s</a></h3>\n" "$title"
printf '<h3 class="indexline-title"><a href="%s.html">%s</a></h3>\n' "$prefix" "$title"
dateandtags $prefix
}

Expand All @@ -275,7 +277,7 @@ done

# reindex
maketagindex
rm cache/dirtytags
cache/dirtytags
if [ $dirty = 1 ]; then
echo rebuilding index
makeindex
Expand Down

0 comments on commit 05ba1ad

Please sign in to comment.