summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xupdate.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/update.sh b/update.sh
index 1259e4a..a4df92f 100755
--- a/update.sh
+++ b/update.sh
@@ -1,14 +1,17 @@
#!/bin/sh
-echo Generating index
+GEN_TITLE='
+BEGIN { show = 1; ORS=""; }
+/Time-stamp/ { printf("%s - ", substr($2,2)) }
+/^# / && show { print substr($0,3); show = 0 }'
+
+echo Generating index-all.gmi
printf "# l-3.space: all\n\nAll content\n" > index-all.gmi
for f in log*gmi; do
- printf '=> gemini://l-3.space/%s %s - %s\n' \
- $f\
- "$(head -n1 $f | sed 's/Time-stamp: <\([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\) ..h.. UTC>/\1/')"\
- "$(grep '^# ' $f | head -n1 | cut -d\ -f2-)";
+ printf '=> gemini://l-3.space/%s %s\n' $f "$(awk -- "$GEN_TITLE" $f)"
done | sort -r >> index-all.gmi
+echo Updating index.gmi
ed index.gmi <<EOF
/^## Recent posts/+
+,/^## Indices/-2d