From eff73abb653dfb50546ec66d251eb41616524c28 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sun, 25 Apr 2021 14:55:55 -0400 Subject: [PATCH] jam-tuesday: Create HTML rollup of stats ("Archive") This is really just a pretty HTML file that replaces the httpd auto-index of the jam-tuesday directory. Some cleanup may be in need later (piping the jam-stats.sh output to sed is a bit ugly... likely better to teach it to emit HTML). In general, this whole "jam-tuesday" project has had me questioning the value of mdoc(7) for non blog-post things... I want to ensure the site is accessible via WWW (with/without JS), Gopher (plaintext version needed) and soon Gemini.. so it's unclear if I'd be better off moving to a more plaintext friendly syntax (like back to markdown :/ ). --- Makefile | 8 ++++++-- bin/jam-index.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jam-tuesday.7 | 7 +++---- 3 files changed, 70 insertions(+), 6 deletions(-) create mode 100755 bin/jam-index.sh diff --git a/Makefile b/Makefile index b96a528..44e71fb 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ # clean -- deletes said HTML HTML != echo index.html *.[1-9] | sed 's/\.[1-9]/.html/g' SETS != find jam-tuesday -name '[01][0-9]-*' +JAMGEN = jam-tuesday/index.html jam-tuesday/greatest-hits # Running with HIDE="" shows the full build command instead # of the abbreviated version (@ suppresses the command in make) @@ -13,11 +14,11 @@ CC = cc CFLAGS = -g -O2 -Wall -Wpedantic -Wextra .PHONY: build -build: $(HTML) atom.xml jam-tuesday/greatest-hits bin/kiosk +build: $(HTML) atom.xml $(JAMGEN) bin/kiosk .PHONY: clean clean: - rm -f $(HTML) atom.xml jam-tuesday/greatest-hits + rm -f $(HTML) atom.xml $(JAMGEN) index.html: ln -sf intro.html $@ @@ -25,6 +26,9 @@ index.html: atom.xml: blog.7 bin/genatom.sh ./bin/genatom.sh > $@ +jam-tuesday/index.html: $(SETS) bin/jam-index.sh + ./bin/jam-index.sh > $@ + jam-tuesday/greatest-hits: $(SETS) bin/jam-stats.sh (date; echo; ./bin/jam-stats.sh) > $@ diff --git a/bin/jam-index.sh b/bin/jam-index.sh new file mode 100755 index 0000000..04be6fc --- /dev/null +++ b/bin/jam-index.sh @@ -0,0 +1,61 @@ +#!/bin/sh +set -e +REPO=$(dirname "$(dirname "$0")") +DIR="$REPO/jam-tuesday" + +cat < + + + + +Jam Tuesday Archive + + + +

Jam Tuesday Archive

+

Welcome to the archive! For more information on the project, +refer to jam-tuesday(7).

+

Stats

+
+EOM + +"$REPO"/bin/jam-stats.sh | sed \ + -e 's#^$##' \ + -e 's#.*:$#

&

#' \ + -e 's#^-*$#