diff options
Diffstat (limited to '')
-rwxr-xr-x | feed.sh | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/feed.sh b/feed.sh index 4a45ce45..3c6e6589 100755 --- a/feed.sh +++ b/feed.sh @@ -2,24 +2,28 @@ set -e -u updated=$(date -u '+%FT%TZ') -echo '<?xml version="1.0" encoding="utf-8"?>' -echo '<feed xmlns="http://www.w3.org/2005/Atom">' -echo '<title>Causal Agency</title>' -echo '<author><name>June</name><email>june@causal.agency</email></author>' -echo '<link href="https://text.causal.agency"/>' -echo '<id>https://text.causal.agency/</id>' -echo "<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') - echo '<entry>' - echo "<title>${title}</title>" - echo "<summary>${summary}</summary>" - echo "<link href=\"https://text.causal.agency/${entry%.7}.txt\"/>" - echo "<id>${url}</id>" - echo "<updated>${updated}</updated>" - echo '</entry>' + cat <<EOF + <entry> + <title>${title}</title> + <summary>${summary}</summary> + <link href="${url}"/> + <id>${url}</id> + <updated>${updated}</updated> + </entry> +EOF done echo '</feed>' |