Browse Source

Improve formatting of RSS posts

pull/269/head
Thomas Profitt 7 years ago
parent
commit
9fc23f7d02
  1. 16
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

16
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -348,12 +348,18 @@ func (s *Service) sendToRooms(cli *gomatrix.Client, feedURL string, feed *gofeed
return nil
}
// SomeOne posted a new article: Title Of The Entry ( https://someurl.com/blag )
func itemToHTML(feed *gofeed.Feed, item gofeed.Item) gomatrix.HTMLMessage {
return gomatrix.GetHTMLMessage("m.notice", fmt.Sprintf(
"<i>%s</i> posted a new article: %s ( %s )",
html.EscapeString(feed.Title), html.EscapeString(item.Title), html.EscapeString(item.Link),
))
return &gomatrix.HTMLMessage{
Body: fmt.Sprintf("%s: %s (%s)",
html.EscapeString(feed.Title), html.EscapeString(item.Title), html.EscapeString(item.Link)),
MsgType: "m.notice",
Format: "org.matrix.custom.html",
FormattedBody: fmt.Sprintf("<strong>%s</strong>:<br><a href=\"%s\"><strong>%s</strong></a>",
html.EscapeString(feed.Title), html.EscapeString(item.Link), html.EscapeString(item.Title)),
// SomeOne posted a new article: Title Of The Entry ( https://someurl.com/blag )
// FeedTitle:
// Title of the Entry which is a Link to It
}
}
func ensureItemsHaveGUIDs(feed *gofeed.Feed) {

Loading…
Cancel
Save