diff options
author | Bradley Taunt <bt@btxx.org> | 2024-07-05 16:10:18 -0400 |
---|---|---|
committer | Bradley Taunt <bt@btxx.org> | 2024-07-05 16:10:18 -0400 |
commit | cc72ef25c6de2b0004c163d06486d949acf3c78c (patch) | |
tree | 32a2941993a3a5c29e79748ef38022e8835437d0 | |
parent | 9617d4122d14f79cb87692eb097f1d9111addeac (diff) |
Tweak barf to mimic existing ikiwiki based URL scheme, include closing main tag
-rwxr-xr-x | barf | 20 | ||||
-rw-r--r-- | footer.html | 1 |
2 files changed, 14 insertions, 7 deletions
@@ -18,7 +18,7 @@ set -eu MARKDOWN=kramdown 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 @@ -39,7 +39,7 @@ index_html() { # Posts while read -r f title created; do - link=$(echo "$f" | sed -E 's|.*/(.*).md|\1/|') + link=$(echo "$f" | sed -E 's|.*/(.*).md|posts/\1/|') created=$(echo $(head -3 "$f" | tail -1)) echo "<li><span>$created</span><a href=\"$link\">$title</a></li>" done < "$1" | sort -r @@ -67,9 +67,8 @@ atom_xml() { 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|\1|') + post_link=$(echo "$f" | sed -E 's|posts/(.*).md|posts/\1|') basic_date=$(echo $(head -3 "$f" | tail -1)) published_date=$(date -d $basic_date -u +%Y-%m-%dT10:%M:%SZ) @@ -107,7 +106,7 @@ 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|\1|') + post_link=$(echo "$f" | sed -E 's|posts/(.*).md|posts/\1|') basic_date=$(echo $(head -3 "$f" | tail -1)) published_date=$(date -d "$basic_date" -u +"%a, %d %b %Y %H:%M:%S %z") @@ -129,8 +128,15 @@ EOF write_page() { filename=$1 directory=$(echo $(basename "$filename" .md)) - $(mkdir -p build/$directory) - target=$(echo "$filename" | sed -r 's|\w+/(.*).md|build/\1/index.html|') + 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 created=$(echo $(head -3 "$filename" | tail -1)) title=$2 diff --git a/footer.html b/footer.html index 7974080..71f386b 100644 --- a/footer.html +++ b/footer.html @@ -1,3 +1,4 @@ +</main> <footer role="contentinfo"> <h2>Menu Navigation</h2> <ul id="menu"> |