diff --git a/img/rss3.gif b/img/rss3.gif new file mode 100644 index 0000000..9b1fc63 Binary files /dev/null and b/img/rss3.gif differ diff --git a/jq/convert/rss2rss3.jq b/jq/convert/rss2rss3.jq new file mode 100644 index 0000000..868c987 --- /dev/null +++ b/jq/convert/rss2rss3.jq @@ -0,0 +1,35 @@ +# RSS 2.0 to RSS 3.0 converter +# Expects xmltodict JSON output, returns an RSS 3.0 feed + +def ensure_array: (. // []) | if type == "array" then . else [.] end; +def ensure_string: if type == "array" then .[0] else . end | if type == "object" then .["#text"] else . end; + +.rss.channel +| [{ + "title": .title, + "link": .link, + "description": .description, + "generator": .generator, + "last-modified": .pubDate, + "language": .language, + "rights": .copyright, + "creator": (.managingEditor // .webMaster), + "errorsto": "lucidiot@brainshit.fr" +}] + [.item | ensure_array[] | { + "title": .title, + "link": .link, + "description": .description, + "creator": .author, + "last-modified": .pubDate, + "guid": .guid, + "uri": (if (.guid|type) == "string" or .guid?["@isPermaLink"] != "false" then .guid else null end) +}] +| map([ + map_values(ensure_string) + | to_entries[] + | select(.value | . != null and length) + | "\(.key): \(.value)" + # Ensure there are spaces after all newlines + | gsub("\n"; "\n ") +] | join("\n")) +| join("\n\n") diff --git a/xslt/itsb.xsl b/xslt/itsb.xsl index 3bfa3f7..3d06cbb 100644 --- a/xslt/itsb.xsl +++ b/xslt/itsb.xsl @@ -102,6 +102,10 @@ + + + + @@ -182,9 +186,13 @@ .json + + + true + - +