summaryrefslogtreecommitdiff
path: root/genrss.sh
diff options
context:
space:
mode:
Diffstat (limited to 'genrss.sh')
-rwxr-xr-xgenrss.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/genrss.sh b/genrss.sh
index 7e6933d..fa36597 100755
--- a/genrss.sh
+++ b/genrss.sh
@@ -1,5 +1,19 @@
#!/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"?>
@@ -7,8 +21,9 @@ cat <<- EOT
<channel>
<title>$title</title>
<link>$link/</link>
+ <atom:link href="$link/feed.xml" rel="self" type="application/rss+xml" />
<description>$description</description>
- <managingEditor>mvertes@free.fr</managingEditor>
+ <managingEditor>$email ($author)</managingEditor>
<pubDate>$(date -R)</pubDate>
EOT
@@ -18,12 +33,15 @@ for d in *; do
. ./meta.sh
cat <<- EOT
<item>
+ <guid isPermaLink="true">$link/$d/</guid>
<title>$title</title>
<link>$link/$d/</link>
<description>$description</description>
- <author>$author</author>
+ <author>$email ($author)</author>
<pubDate>$date_rfc2822</pubDate>
- <content:encoded><![CDATA[$(awk '/<h1 / {p=!p} p' index.html)]]></content:encoded>
+ <content:encoded>
+ <![CDATA[$(fixhtml "$link/$d/" index.html)]]>
+ </content:encoded>
</item>
EOT
done