blob: b1423860e818f9432c3f512ab3e0082aa747b2bb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
set -euo pipefail
usage() {
echo 'Usage: feed GLOBALCONF SORTDATA'
}
GLOBALCONF="${1:-}"
FILENAME="${2:-}"
eval "$(assert-arg -- "$GLOBALCONF" 'GLOBALCONF')"
eval "$(assert-arg -- "$FILENAME" 'SORTDATA')"
. ./"$GLOBALCONF"
shift
pre() {
cat <<EOF | sed '/^$/d'
<feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xml:lang="en">
<link rel="self" type="application/atom+xml" href="$feed_url_absolute" />
<link rel="alternate" type="text/html" href="$feed_alternate_url_absolute" hreflang="en" />
<title>$site_name_html</title>
<subtitle>$feed_title_html</subtitle>
<id>$feed_url_absolute</id>
<updated>$now_iso</updated>
<author>
<name>$author</name>
<email>$email</email>
</author>
EOF
}
post() {
printf '</feed>\n'
}
pre
cat "$FILENAME" |
xargs cat |
sort -nr |
xargs cat |
sed 's/\.sortdata$/.feedentry/' |
xargs cat
post
|