commit - 6e67a846f060ff6bb436cd2ff269b181ac52980c
commit + 70d8bb745024d2b382a93522e258fc28e7cc0c67
blob - 5c0db4d36ddddd7eb7ea4f93a1dc28943a5a66b7
blob + bbbe550ccd8a4bde044e79d3641bdca5104e1ff4
--- barf
+++ barf
MARKDOWN=lowdown
IFS=' '
-# Create tab-separated file with filename, title, creation date, last update
+# Create tab separated file with filename, title, creation date, last update
index_tsv() {
for f in "$1"/*.md
do
# Intro text
$MARKDOWN index.md
- echo "<ul class='posts'>"
+ echo "<ul>"
# Posts
while read -r f title created; do
- link=$(echo "$f" | sed -E 's|.*/(.*).md|posts/\1/|')
+ link=$(echo "$f" | sed -E 's|.*/(.*).md|\1/|')
created=$(echo $(head -3 "$f" | tail -1))
- echo "<li><span>$created</span><a href=\"$link\">$title</a></li>"
+ echo "<li>$created · <a href=\"$link\">$title</a></li>"
done < "$1" | sort -r
echo "</ul>"
EOF
while read -r f title created; do
+
content=$($MARKDOWN "$f" | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g')
- post_link=$(echo "$f" | sed -E 's|posts/(.*).md|posts/\1|')
+ post_link=$(echo "$f" | sed -E 's|posts/(.*).md|\1|')
basic_date=$(echo $(head -3 "$f" | tail -1))
published_date=$(date -d $basic_date -u +%Y-%m-%dT10:%M:%SZ)
while read -r f title created; do
content=$($MARKDOWN "$f" | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g')
- post_link=$(echo "$f" | sed -E 's|posts/(.*).md|posts/\1|')
+ post_link=$(echo "$f" | sed -E 's|posts/(.*).md|\1|')
basic_date=$(echo $(head -3 "$f" | tail -1))
published_date=$(date -d "$basic_date" -u +"%a, %d %b %Y %H:%M:%S %z")
write_page() {
filename=$1
directory=$(echo $(basename "$filename" .md))
- if echo "$filename" | grep -q "^posts/"; then
- # Create a directory under build/posts
- $(mkdir -p build/posts/$directory)
- target=$(echo "$filename" | sed -r 's|posts/(.*).md|build/posts/\1/index.html|')
- else
- # Create a directory under build for pages
- $(mkdir -p build/$directory)
- target=$(echo "$filename" | sed -r 's|pages/(.*).md|build/\1/index.html|')
- fi
+ $(mkdir -p build/$directory)
+ target=$(echo "$filename" | sed -r 's|\w+/(.*).md|build/\1/index.html|')
created=$(echo $(head -3 "$filename" | tail -1))
title=$2
> "$target" && cat footer.html >> "$target"
}
+rm -rf build && mkdir build
+
# Blog posts
index_tsv posts | sort -rt " " -k 3 > build/posts.tsv
index_html build/posts.tsv > build/index.html