summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capsule.Dockerfile1
-rw-r--r--capsule/.gitignore1
-rwxr-xr-xcapsule/build_longlog.bash38
-rw-r--r--capsule/content/logs/longlog.gmi31
-rw-r--r--capsule/templates/longlog-header.gmi3
5 files changed, 43 insertions, 31 deletions
diff --git a/capsule.Dockerfile b/capsule.Dockerfile
index 0ab6f8f..9a72efd 100644
--- a/capsule.Dockerfile
+++ b/capsule.Dockerfile
@@ -38,6 +38,7 @@ RUN while read feed; do \
COPY capsule .
COPY common /var/common
RUN ./build_microlog.bash
+RUN ./build_longlog.bash
RUN ./build_loglog.bash
CMD \
diff --git a/capsule/.gitignore b/capsule/.gitignore
index 9456912..7ae26f9 100644
--- a/capsule/.gitignore
+++ b/capsule/.gitignore
@@ -1,4 +1,5 @@
.certificates
content/logs/microlog.gmi
+content/logs/longlog.gmi
content/logs/loglog.gmi
tmp-build-loglog-*
diff --git a/capsule/build_longlog.bash b/capsule/build_longlog.bash
new file mode 100755
index 0000000..d23acfa
--- /dev/null
+++ b/capsule/build_longlog.bash
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+LONGLOG="content/logs/longlog.gmi"
+LONGLOG_HEADER="templates/longlog-header.gmi"
+LONGLOG_SRC_DIR="content/logs/longlog"
+HR="-----------------------------------------------------------------------"
+
+trim_longlog_tail()
+{
+ while [[ -z "$(tail -n 1 "$LONGLOG")" && "$(wc -l "$LONGLOG" | cut -c1)" -ne 0 ]]; do
+ head -n -1 "$LONGLOG" | tee "$LONGLOG" 1>/dev/null
+ done
+}
+
+echo "Cleaning existing longlog..."
+rm -f "$LONGLOG"
+
+echo "Copying longlog header..."
+cp "$LONGLOG_HEADER" "$LONGLOG"
+trim_longlog_tail
+echo "" >> "$LONGLOG"
+
+echo "Appending entries to longlog..."
+posts=(${LONGLOG_SRC_DIR}/*)
+for ((i=${#posts[@]}-1; i>=0; i--)); do
+ post="${posts[i]}"
+ if [[ "$post" =~ ${LONGLOG_SRC_DIR}/([0-9]{4}-[0-9]{2}-[0-9]{2}(\.[0-9]+)?)\.gmi ]]; then
+ date="${BASH_REMATCH[1]}"
+ suffix="${BASH_REMATCH[2]}"
+ title="$(head -n 1 "${posts[i]}" | sed "s/^\#\+ *//")"
+ echo "=> /logs/longlog/${date}${suffix}.gmi ${date} ${title}" >> "$LONGLOG"
+ else
+ echo "Error: $post does not match format YYYY-MM-DD(.n). Aborting..."
+ exit 1
+ fi
+done
+
+echo "Done."
diff --git a/capsule/content/logs/longlog.gmi b/capsule/content/logs/longlog.gmi
deleted file mode 100644
index 711c31c..0000000
--- a/capsule/content/logs/longlog.gmi
+++ /dev/null
@@ -1,31 +0,0 @@
-# joeac's longlog
-
-Hi! I'm Joe Carstairs, and you've found my longlog. Sometimes, I write a long or long-ish post, and I put it here.
-
-=> /logs/longlog/2026-04-12.gmi 2026-04-12 Green apocalypse (my dissertation proposal)
-=> /logs/longlog/2026-03-28.gmi 2026-03-28 I'm a Protestant, why should I care about Vatican II?
-=> /logs/longlog/2026-03-21.gmi 2026-03-21 The structure of Genesis
-=> /logs/longlog/2026-03-04.gmi 2026-03-04 What is an agnostic?
-=> /logs/longlog/2026-02-16.gmi 2026-02-16 10 very short stories about the Reformation
-=> /logs/longlog/2025-12-11.gmi 2025-12-11 Why did the church become persecuting in the fourth century?
-=> /logs/longlog/2025-10-09.gmi 2025-10-09 Arianism
-=> /logs/longlog/2025-10-05.gmi 2025-10-05 "381: how the church as we know it was made"
-=> /logs/longlog/2025-09-18.gmi 2025-09-18 Changing my ambitions
-=> /logs/longlog/2025-07-03.gmi 2025-07-03 Why Psalm 118 is the theme tune to Matthew's Gospel
-=> /logs/longlog/2025-06-23.gmi 2025-06-23 Figuring things out
-=> /logs/longlog/2025-05-04.gmi 2025-05-04 Does resurrection doctrine give us unique reasons to work for justice?
-=> /logs/longlog/2025-05-02.gmi 2025-05-02 Surprised By Hope
-=> /logs/longlog/2025-01-28.gmi 2025-01-28 A paradox about 'should'
-=> /logs/longlog/2025-01-24.gmi 2025-01-24 Why scientists need philosophers
-=> /logs/longlog/2025-01-19.gmi 2025-01-19 How I read things on the Internet now (no, of course I don't leave the terminal!)
-=> /logs/longlog/2024-12-17.gmi 2024-12-17 Questions I have about sex
-=> /logs/longlog/2024-07-16.gmi 2024-07-16 What do academics think LLM ‘hallucination’ means?
-=> /logs/longlog/2024-07-08.gmi 2024-07-08 Doctor Who, Gayness, and the Church
-=> /logs/longlog/2024-06-13.gmi 2024-06-13 LLMs do not understand anything
-=> /logs/longlog/2024-05-02.gmi 2024-05-02 How I made YouTube work for me
-=> /logs/longlog/2024-04-14.gmi 2024-04-14 God Is Not Great, initial thoughts
-=> /logs/longlog/2024-04-11.gmi 2024-04-11 Who consecrates the tabernacle? (Ex 29)
-=> /logs/longlog/2024-04-10.gmi 2024-04-10 Tracking pixels
-=> /logs/longlog/2024-03-30.gmi 2024-03-30 Why Easter is the best week of the year
-=> /logs/longlog/2024-01-29.gmi 2024-01-29 EUHWC Toast to the Lassies 2024
-=> /logs/longlog/2024-01-14.gmi 2024-01-14 Harari’s Sapiens on Religion
diff --git a/capsule/templates/longlog-header.gmi b/capsule/templates/longlog-header.gmi
new file mode 100644
index 0000000..6e82e48
--- /dev/null
+++ b/capsule/templates/longlog-header.gmi
@@ -0,0 +1,3 @@
+# joeac's longlog
+
+Hi! I'm Joe Carstairs, and you've found my longlog. Sometimes, I write a long or long-ish post, and I put it here.