blob: f202ba67f31553e1b0433782038ef817f5820872 (
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
49
50
51
52
|
#!/bin/sh
set -eu
usage() {
echo 'Usage: feed FILENAME'
}
FILENAME="${1:-}"
eval "$(assert-arg -- "$FILENAME" 'FILENAME')"
absolute() {
printf 'https://domain-here.com/%s' "$(cat -)"
}
feed_article_title=''
site_name=' '
lang=en
now="$(date -uIs)"
url_absolute="$(printf '%s' "${FILENAME#src/}" | absolute)"
site_name_html="$(htmlesc "${site_name:?}")"
collection=article
collection_url_absolute="$(printf '%s' ${lang:?}/ | absolute)"
feed_title_html="$(eval "echo \"\$feed_${collection}_title\"" | htmlesc)"
export now url_absolute site_name_html collection_url_absolute feed_title_html
DIR="$(dirname "$FILENAME")"
author=
email=
cat <<EOF
<feed
xmlns="http://www.w3.org/2005/Atom"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xml:lang="$lang">
<link href="$url_absolute" rel="self" type="application/atom+xml" />
<link href="$collection_url_absolute" rel="alternate" type="text/html" hreflang="$lang" />
<title>$site_name_html</title>
<subtitle>$feed_title_html</subtitle>
<id>$url_absolute</id>
<updated>$now</updated>
<author>
<name>$author</name>
<email>$email</email>
</author>
EOF
find "$@" |
xargs cat |
sort -nr |
xargs cat
printf '</feed>\n'
|