From 135c48b2dea5763feabb47606f71ebd713d6567a Mon Sep 17 00:00:00 2001 From: Bradley Taunt Date: Wed, 14 Aug 2024 09:08:10 -0400 Subject: Switch over to wruby, include new TUI browsers, extras page --- barf | 158 ------------------------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100755 barf (limited to 'barf') diff --git a/barf b/barf deleted file mode 100755 index e027fc0..0000000 --- a/barf +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh - -domain="https://jsfree.org" - -# Check the operating system -os_name=$(uname -s) - -if [ "$os_name" = "OpenBSD" ]; then - alias sed=gsed - alias date=gdate - alias rsync=openrsync -elif [ "$os_name" = "Darwin" ]; then - alias sed=gsed - alias date=gdate -fi - -set -eu -MARKDOWN=smu -IFS=' ' - -# Create tab separated file with filename, title, creation date, last update -index_tsv() { - for f in "$1"/*.md - do - title=$(sed -n '/^# /{s/# //p; q}' "$f") - printf '%s\t%s\t%s\t%s\n' "$f" "${title:="No Title"}" - done -} - -index_html() { - # Print header - title=$(sed -n '/^# /{s/# //p; q}' index.md) - sed "s/{{TITLE}}/$title/" header.html - - # Intro text - $MARKDOWN index.md - - echo "" - - # Print footer after post list - cat footer.html -} - -atom_xml() { - uri=$(sed -rn '/atom.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) - first_commit_date=$(git log --pretty='format:%ai' . | cut -d ' ' -f1 | tail -1) - - cat < - - $(sed -n '/^# /{s/# //p; q}' index.md) - - $(date +%FT%TZ) - - $(git config user.name) - - $domain,$first_commit_date:default-atom-feed/ -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 +%Y-%m-%dT10:%M:%SZ) - - cat < - $title - $content - - $domain/$post_link - $published_date - $published_date - -EOF - done < "$1" - - echo '' -} - -rss_xml() { - uri=$(sed -rn '/rss.xml/ s/.*href="([^"]*)".*/\1/ p' header.html) - 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 - $content - $domain/$post_link - $domain/$post_link - $published_date - -EOF - done < "$1" - - echo '' - echo '' -} - -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|') - created=$(echo $(head -3 "$filename" | tail -1)) - title=$2 - - $MARKDOWN "$filename" | \ - cat header.html - |\ - sed "s|{{TITLE}}|$title|" \ - > "$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 -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 - -# Pages -index_tsv pages > build/pages.tsv -while read -r f title created; do - write_page "$f" "$title" "$created" -done < build/pages.tsv -- cgit v1.2.3-54-g00ecf