blob: 8e999dbce972171df65accf76f456ffe874e7bef (
plain)
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
fixhtml() {
gawk '
# Skip everything before first <h1>.
/<h1 / { p = !p }
p {
# Make reference links absolute.
$0 = gensub(/<img src="([^hH][^"]*)"/, "<img src=\"'$1'\\1\"", "g")
$0 = gensub(/<a href="([^hH][^"]*)"/, "<a href=\"'$1'\\1\"", "g")
print
}
' "$2"
}
. ./meta.sh
cat <<- EOT
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="$link/feed.xml" rel="self" type="application/rss+xml" />
<title>$title</title>
<link>$link/</link>
<description>$description</description>
<managingEditor>$email ($author)</managingEditor>
<pubDate>$(date -R)</pubDate>
EOT
for d in *; do
[ -d "$d" ] || continue
cd $d
. ./meta.sh
cat <<- EOT
<item>
<guid isPermaLink="true">$link/$d/</guid>
<title>$title</title>
<link>$link/$d/</link>
<description>$description</description>
<author>$email ($author)</author>
<pubDate>$date_rfc2822</pubDate>
<content:encoded>
<![CDATA[$(fixhtml "$link/$d/" index.html)]]>
</content:encoded>
</item>
EOT
done
cat <<- EOT
</channel>
</rss>
EOT
|