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 --- .build.yml | 17 +++--- .ruby-version | 1 + Makefile | 11 +--- README.md | 6 +- _config.yml | 21 +++++++ barf | 158 --------------------------------------------------- footer.html | 5 +- header.html | 5 +- index.md | 2 +- pages/browsers.md | 15 +++++ pages/extras.md | 13 +++++ pages/posts.md | 1 + pages/web-hosting.md | 5 ++ wruby.rb | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 228 insertions(+), 182 deletions(-) create mode 100644 .ruby-version create mode 100644 _config.yml delete mode 100755 barf create mode 100644 pages/extras.md create mode 100644 pages/posts.md create mode 100644 wruby.rb diff --git a/.build.yml b/.build.yml index c762838..3b25043 100644 --- a/.build.yml +++ b/.build.yml @@ -1,8 +1,8 @@ image: alpine/latest oauth: pages.sr.ht/PAGES:RW packages: -- rsync -- coreutils +- ruby +- ruby-dev - go - hut environment: @@ -10,16 +10,13 @@ site: jsfree.org sources: - https://git.sr.ht/~bt/jsfree.org tasks: -- install-smu: | - git clone https://git.sr.ht/~bt/smu - cd smu - sudo make - sudo make install +- install-gems: | + sudo gem install bundler 'kramdown:2.4.0' 'rss:0.3.0' - build: | - cd jsfree.org - make build + cd wruby + sudo make build - package: | cd jsfree.org/build tar -cvz . > ../../site.tar.gz - upload: | - hut pages publish -d jsfree.org site.tar.gz \ No newline at end of file + hut pages publish -d jsfree.org site.tar.gz diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..619b537 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.3 diff --git a/Makefile b/Makefile index b16a580..9d7e5a1 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,8 @@ build: - sh ./barf - rsync -r public/ build/public + rm -rf build && mkdir build + ruby wruby.rb clean: rm -rf build/* -watch: - while true; do \ - ls -d .git/* * posts/* pages/* header.html | entr -cd make ;\ - done - -.PHONY: build clean watch +.PHONY: build clean diff --git a/README.md b/README.md index 4b06549..26b9e26 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ The main website and project for jsfree.org [jsfree.org](https://jsfree.org) -contributing +Built with [wruby](https://wruby.btxx.org) + +Contributing ------------ -Submit changes, patches or suggestions via email [here](mailto:jsfree@patches.btxx.org) +Submit changes, patches or suggestions [here](https://lists.sr.ht/~bt/jsfree-devel) diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..ea5e802 --- /dev/null +++ b/_config.yml @@ -0,0 +1,21 @@ +site_url: 'https://jsfree.org' +site_name: 'jsfree.org' +author_name: 'Bradley Taunt' + +directories: + posts: 'posts' + pages: 'pages' + public: 'public' + output: 'build' + posts_output: 'build/posts' + pages_output: 'build/' + +files: + header: 'header.html' + footer: 'footer.html' + root_index: 'index.md' + posts_index: 'pages/posts.md' + rss: 'build/index.rss' + +misc: + post_count: 5 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 diff --git a/footer.html b/footer.html index 894338a..2c8db87 100644 --- a/footer.html +++ b/footer.html @@ -1,7 +1,7 @@