build longlog.gmi from posts and header template

This commit is contained in:
2026-04-25 10:47:21 +01:00
parent 92b58d8999
commit 9a64bad16e
5 changed files with 43 additions and 31 deletions
+1
View File
@@ -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 \
+1
View File
@@ -1,4 +1,5 @@
.certificates
content/logs/microlog.gmi
content/logs/longlog.gmi
content/logs/loglog.gmi
tmp-build-loglog-*
+38
View File
@@ -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."
-31
View File
@@ -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 Hararis Sapiens on Religion
+3
View File
@@ -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.