diff options
| author | Marc Vertes <mvertes@free.fr> | 2023-05-19 19:00:15 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2023-05-19 19:00:15 +0200 |
| commit | d38ad5ba3ee3677c4d00213fc93497f9031cba08 (patch) | |
| tree | 8330595b6a3851b50c132662286ac05f5819bdf1 /genrss.sh | |
| parent | 13d12e60b8606fd40a2c02594654d4d1da8ace16 (diff) | |
fix rss
Diffstat (limited to 'genrss.sh')
| -rwxr-xr-x | genrss.sh | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -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 |
