42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
# OEAIF feed generator
|
|
# Expects pup JSON output holding <tr> tags, outputs xmltodict-compatible JSON
|
|
# WARNING: Dates are locale-sensitive; the RSS feed might not generate correctly with another locale.
|
|
# Expected variables:
|
|
# $title: Title of the feed
|
|
# $lang: Language code, without the country code (fr/en/nl/de)
|
|
|
|
{
|
|
"rss": {
|
|
"@version": "2.0",
|
|
"channel": {
|
|
"title": $title,
|
|
"description": $title,
|
|
"link": "https://www.rail-investigation.be/\($lang)/",
|
|
"language": "\($lang)-BE",
|
|
"pubDate": (now | strftime("%a, %d %b %Y %T %z")),
|
|
"docs": "https://www.rssboard.org/rss-specification",
|
|
"ttl": 1440,
|
|
"generator": "ITSB",
|
|
"item": [.[] | {
|
|
"title": .children[2].text,
|
|
"description": (
|
|
[
|
|
([.children[1]] + .children[3:])[]
|
|
| (.["data-title"] + ": " + .text)
|
|
]
|
|
| join("</li><li>")
|
|
| "<ul><li>\(.)</li></ul>"
|
|
),
|
|
"link": .["data-href"],
|
|
"guid": .["data-href"],
|
|
"pubDate": (
|
|
.children[0].text
|
|
| strptime("%d/%m/%Y")
|
|
| mktime
|
|
| strftime("%a, %d %b %Y %T %z")
|
|
)
|
|
}]
|
|
}
|
|
}
|
|
}
|