website/scripts/feed.uppatom

41 lines
1.0 KiB
XML

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<feed xmlns='http://www.w3.org/2005/Atom' >
<title>techn0path</title>
<link rel='self' href='' />
<author>
<name>techn0path</name>
</author>
#!
if test "$2" = "yes" ; then
export CONVERT_GMI_LINKS="YES"
fi
printf '<updated>%s</updated>
<id>urn:uuid:%s</id>\n' "$(date -u -r $1 '+%Y-%m-%dT%TZ')" "$(uuidgen -s --namespace @x500 --name \'techn0path\')"
awk -F "\t" '/^#/ { next }
{
if (NF < 2) next
date = $1
url = $2
if (NF > 2) title = $3
else title = "Content update at " url
sprintf("uuidgen -s --namespace @url --name \"%s-%s\"", title, date) | getline uuid
sprintf("date -d %s \"%s\"", date, "+%Y-%m-%dT%TZ") | getline tmp
date = tmp
if (ENVIRON["CONVERT_GMI_LINKS"] == "YES" && ! match(url, "^(.*):\\/\\/"))
sub("\\.gmi$", ".html", url)
printf "<entry> \n\
<title>%s</title> \n\
<link href=\"%s\" /> \n\
<id>urn:uuid:%s</id> \n\
<updated>%s</updated> \n\
<summary>%s</summary> \n\
</entry>\n", title, url, uuid, date, title
}' $1
#!
</feed>