commit 7b2dc83a3a3b2da494e1b1370e3ecac94a9c9342 from: Bradley Taunt date: Thu Jun 06 12:36:27 2024 UTC Include RSS feed generation, check operating system to set aliases commit - 6b829cb0bb86bd75b872f32f3121722b000ec419 commit + 7b2dc83a3a3b2da494e1b1370e3ecac94a9c9342 blob - 81bbcd2bc21da39eab9f8673b3b79405892919f9 blob + 528dece9f4230bf4c58306281343e2df56f58ee6 --- barf +++ barf @@ -1,4 +1,15 @@ #!/bin/sh + +# Check the operating system +os_name=$(uname -s) + +if [ "$os_name" = "OpenBSD" ]; then + alias sed=gsed +elif [ "$os_name" = "Darwin" ]; then + alias sed=gsed + alias date=gdate +fi + set -eu MARKDOWN=smu IFS=' ' @@ -74,6 +85,45 @@ EOF echo '' } +rss_xml() { + uri=$(sed -rn '/rss.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) + domain=$(echo "$uri" | sed 's/rss.xml//g' | sed 's|/[^/]*$||') + first_commit_date=$(git log --pretty='format:%ai' . | cut -d ' ' -f1 | tail -1) + + cat < + + + $(sed -n '/^# /{s/# //p; q}' index.md) + $domain/rss.xml + Feed description here + $(date -u +"%a, %d %b %Y %H:%M:%S %z") + $(date -u +"%a, %d %b %Y %H:%M:%S %z") + Custom RSS Generator + 1800 +EOF + + while read -r f title created; do + content=$($MARKDOWN "$f" | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g') + 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") + + cat < + $title + + $domain/$post_link + $domain/$post_link + $published_date + +EOF + done < "$1" + + echo '' + echo '' +} + write_page() { filename=$1 directory=$(echo $(basename "$filename" .md)) @@ -94,6 +144,7 @@ rm -rf build && mkdir build index_tsv posts | sort -rt " " -k 3 > build/posts.tsv index_html build/posts.tsv > build/index.html atom_xml build/posts.tsv > build/atom.xml +rss_xml build/posts.tsv > build/rss.xml while read -r f title created; do write_page "$f" "$title" "$created" done < build/posts.tsv blob - f172116735bd636eecd5f4034ed4ba3c5b0361a7 blob + be0489e4b68419b4d9eb61df5280493532884581 --- build/about/index.html +++ build/about/index.html @@ -29,6 +29,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - dc8835da42c0a112c4414ec0dd427c934c654038 blob + dfe09d269a362e9885408892bee186318c28343f --- build/atom.xml +++ build/atom.xml @@ -2,7 +2,7 @@ barf - 2024-06-04T11:19:14Z + 2024-06-06T08:34:47Z Bradley Taunt blob - 62b6f54cb97040f78e9f1ed3f54b004b3e78bb90 blob + 16b767272319e0ab21783598225fbbb0ec71bc4f --- build/cleanup/index.html +++ build/cleanup/index.html @@ -42,6 +42,7 @@ pre{overflow:auto;}
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - dca88743d2463c10e6771cf9db4cbba9410a847f blob + a5aaf194bb430df65038274c03e5e88fdf287003 --- build/dark-mode/index.html +++ build/dark-mode/index.html @@ -35,6 +35,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - 10a7f8379e7d77cff160800f68352c94c4441305 blob + b47b9afed0e87ea5b53ed50ad20600b27aee078c --- build/index.html +++ build/index.html @@ -39,6 +39,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - 466f6bbb60f7956de22988e3ea85e037cc8545e0 blob + f3d1d742aa041f550caef4aa345b3300a20d72c6 --- build/macos/index.html +++ build/macos/index.html @@ -43,6 +43,7 @@ sudo ln -fs /opt/homebrew/bin/gdate /usr/local/bin/dat
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - 94fe221ea9237329ca9aba14fe34a44c4f38f3b7 blob + 043a664898b0bc7197a1ca0a0efb1b553f75f62c --- build/markdown-examples/index.html +++ build/markdown-examples/index.html @@ -257,6 +257,7 @@ tags.

  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - 109950293dad2e0e6583032911e9e6ef8c931edd blob + 7d75ce1055cee36304ce9d58807793d9e9a7e228 --- build/openbsd/index.html +++ build/openbsd/index.html @@ -33,6 +33,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - f2ba617d66d920c5816d3aef77095e264ae768c6 blob + 417afa57f23ea7e76a16ddf66df1d205c1faf364 --- build/websites/index.html +++ build/websites/index.html @@ -32,6 +32,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.
    blob - /dev/null blob + 065e51d13e78a45a4f9807746cd426ed1789826a (mode 644) --- /dev/null +++ build/rss.xml @@ -0,0 +1,332 @@ + + + + barf + /rss.xml + Feed description here + Thu, 06 Jun 2024 12:34:47 +0000 + Thu, 06 Jun 2024 12:34:47 +0000 + Custom RSS Generator + 1800 + + Running `barf` on OpenBSD + + /openbsd + /openbsd + Sat, 12 Aug 2023 00:00:00 +0000 + + + Markdown Examples in barf + + /markdown-examples + /markdown-examples + Thu, 05 Jan 2023 00:00:00 +0000 + + + Running `barf` on MacOS + + /macos + /macos + Wed, 18 Jan 2023 00:00:00 +0000 + + + Supporting Basic Dark Mode + + /dark-mode + /dark-mode + Tue, 07 Mar 2023 00:00:00 +0000 + + + Cleaning Up barf's Structure + + /cleanup + /cleanup + Mon, 09 Oct 2023 00:00:00 +0000 + + + blob - 861f246ee314433b13c353ba80bf9de7f3b3aad8 blob + caef8797345b88994d413bd080c66a617b22c66c --- footer.html +++ footer.html @@ -8,6 +8,7 @@
  • Source Code
  • + Feeds: Atom | RSS
    Built with barf.
    The code for this site is MIT.