This commit is contained in:
parent
52cb376335
commit
ab85f65044
2 changed files with 19 additions and 1 deletions
|
|
@ -3,12 +3,20 @@ name = "releases"
|
|||
[[feeds]]
|
||||
url = "https://github.com/nim-lang/Nim/releases.atom"
|
||||
kind = "Atom"
|
||||
titlePrefix = "Nim: "
|
||||
|
||||
[[feeds]]
|
||||
url = "https://github.com/fatedier/frp/releases.atom"
|
||||
kind = "Atom"
|
||||
titlePrefix = "frp: "
|
||||
|
||||
[[feeds]]
|
||||
url = "https://forgejo.org/releases/rss.xml"
|
||||
kind = "RSSv2"
|
||||
timeFormat = "ddd',' dd MMM yyyy HH:mm:ss 'GMT'"
|
||||
titlePrefix = "Forgejo: "
|
||||
timeFormat = "ddd',' dd MMM yyyy HH:mm:ss 'GMT'"
|
||||
|
||||
[[feeds]]
|
||||
url = "https://github.com/project-zot/zot/releases.atom"
|
||||
titlePrefix = "zot: "
|
||||
kind = "Atom"
|
||||
10
src/rss.nim
10
src/rss.nim
|
|
@ -9,6 +9,7 @@ type RssFeed* = object
|
|||
url*: string
|
||||
kind*: FeedType
|
||||
timeFormat*: string
|
||||
titlePrefix*: string
|
||||
|
||||
proc parseAtomTime(s: string): DateTime =
|
||||
parse(s, atomTimeFormat)
|
||||
|
|
@ -57,6 +58,15 @@ proc mixRssFeeds*(feeds: seq[RssFeed], name, id, link, authorName, description:s
|
|||
item
|
||||
)
|
||||
|
||||
if feed.titlePrefix.len > 0:
|
||||
entries[^1].items = entries[^1].items.mapIt(
|
||||
block:
|
||||
var item = it
|
||||
if item.title.isSome():
|
||||
item.title = some(feed.titlePrefix&item.title.get())
|
||||
item
|
||||
)
|
||||
|
||||
for feed in entries:
|
||||
result.items.add feed.items
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue