~strahinja/strahinja.srht.site

ref: a1bdc8f28beb6be015c9d41f1d86de79597f0a5c strahinja.srht.site/blog/default.xml.do -rw-r--r-- 1.5 KiB
a1bdc8f2Страхиња Радић Added .q/.a > ul formatting 7 months ago
                                                                                
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
#!/bin/bash
HEADERLINES=+5
MONTHS=10

cat <<EOT >>$3
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="gemini://gemini.strahinja.org/blog/rss.xml" rel="self" 
    type="application/rss+xml" />
<link>gemini://gemini.strahinja.org/blog/rss.xml</link>
<title>//strahinja.org</title>
<description>Новости са личне странице Страхиње Радића</description>
<category>Blog</category>
<language>sr-rs</language>
<copyright>© 1999-2021 Страхиња Радић (Strahinya Radich)</copyright>
EOT

for d in $(find ../blog-src/*-* -type d | sort -r | head -n ${MONTHS}); do
    if [ -d $d ]; then
        for f in $(find $d -name '*.slw' | sort -r); do
            YAML=$(sed -e '0,/^---/d' -e '/^---/,$d' $f)
            TITLE=$(echo "${YAML}" | grep title: | sed -e 's/title: \+//g')
            DATE=$(echo "${YAML}" | grep date: | sed -e 's/date: \+//g' \
                | xargs -I{} date -R -d"{}")
            cat <<EOT >>$3
    <item>
        <title>$TITLE</title>
        <link>gemini://gemini.strahinja.org/blog/$(echo "$d" | \
		sed -e's/^\.\.\/blog-src\///g')/$(echo "$f" | \
		sed -e's/.*\/\([^\/]*\)\.[a-z]*/\1/g').gmi</link>
        <guid>gemini://gemini.strahinja.org/blog/$(echo "$d" | \
		sed -e's/^\.\.\/blog-src\///g')/$(echo "$f" | \
		sed -e's/.*\/\([^\/]*\)\.[a-z]*/\1/g').gmi</guid>
        <pubDate>$DATE</pubDate>
    </item>
EOT
        done
    fi
done
cat <<EOT >>$3
</channel>
</rss>
EOT