diff options
Diffstat (limited to '')
-rw-r--r-- | www/text.causal.agency/Makefile | 14 | ||||
-rw-r--r--[-rwxr-xr-x] | www/text.causal.agency/feed.sh | 39 |
2 files changed, 27 insertions, 26 deletions
diff --git a/www/text.causal.agency/Makefile b/www/text.causal.agency/Makefile index 8f2a55a1..09076305 100644 --- a/www/text.causal.agency/Makefile +++ b/www/text.causal.agency/Makefile @@ -6,18 +6,18 @@ TXTS += 003-pleasant-c.txt TXTS += 004-uloc.txt TXTS += 005-testing-c.txt -all: $(TXTS) +all: ${TXTS} .SUFFIXES: .7 .txt .7.txt: - mandoc $< | col -b -x > $@ + mandoc $< | col -bx > $@ -feed.atom: $(TXTS) - ./feed.sh > feed.atom +feed.atom: feed.sh ${TXTS} + sh feed.sh > feed.atom clean: - rm -f $(TXTS) feed.atom + rm -f ${TXTS} feed.atom -install: $(TXTS) feed.atom - install -p -m 644 $(TXTS) feed.atom $(WEBROOT) +install: ${TXTS} feed.atom + install -p -m 644 ${TXTS} feed.atom ${WEBROOT} diff --git a/www/text.causal.agency/feed.sh b/www/text.causal.agency/feed.sh index 3c6e6589..21b1d4a3 100755..100644 --- a/www/text.causal.agency/feed.sh +++ b/www/text.causal.agency/feed.sh @@ -1,29 +1,30 @@ #!/bin/sh -set -e -u +set -eu updated=$(date -u '+%FT%TZ') -cat <<EOF -<?xml version="1.0" encoding="utf-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> -<title>Causal Agency</title> -<author><name>June</name><email>june@causal.agency</email></author> -<link href="https://text.causal.agency"/> -<id>https://text.causal.agency/</id> -<updated>${updated}</updated> +cat <<- EOF + <?xml version="1.0" encoding="utf-8"?> + <feed xmlns="http://www.w3.org/2005/Atom"> + <title>Causal Agency</title> + <author><name>June</name><email>june@causal.agency</email></author> + <link href="https://text.causal.agency"/> + <id>https://text.causal.agency/</id> + <updated>${updated}</updated> EOF for entry in *.7; do url="https://text.causal.agency/${entry%.7}.txt" title=$(grep '^\.Nm' "$entry" | cut -c 5-) summary=$(grep '^\.Nd' "$entry" | cut -c 5-) - updated=$(date -j -u -f '%s' "$(stat -f '%m' "$entry")" '+%FT%TZ') - cat <<EOF - <entry> - <title>${title}</title> - <summary>${summary}</summary> - <link href="${url}"/> - <id>${url}</id> - <updated>${updated}</updated> - </entry> -EOF + mtime=$(stat -f '%m' "$entry") + updated=$(date -ju -f '%s' "$mtime" '+%FT%TZ') + cat <<- EOF + <entry> + <title>${title}</title> + <summary>${summary}</summary> + <link href="${url}"/> + <id>${url}</id> + <updated>${updated}</updated> + </entry> + EOF done echo '</feed>' |