1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

feat: populate feed description automatically

This commit is contained in:
Frédéric Guillot 2025-05-24 21:10:13 -07:00
parent 5920e02562
commit 8142268799
9 changed files with 83 additions and 11 deletions

View file

@ -26,9 +26,10 @@ func NewRDFAdapter(rdf *RDF) *RDFAdapter {
func (r *RDFAdapter) BuildFeed(baseURL string) *model.Feed {
feed := &model.Feed{
Title: stripTags(r.rdf.Channel.Title),
FeedURL: strings.TrimSpace(baseURL),
SiteURL: strings.TrimSpace(r.rdf.Channel.Link),
Title: stripTags(r.rdf.Channel.Title),
FeedURL: strings.TrimSpace(baseURL),
SiteURL: strings.TrimSpace(r.rdf.Channel.Link),
Description: strings.TrimSpace(r.rdf.Channel.Description),
}
if feed.Title == "" {

View file

@ -23,8 +23,7 @@ func TestParseRDFSample(t *testing.T) {
<title>XML.com</title>
<link>http://xml.com/pub</link>
<description>
XML.com features a rich mix of information and services
for the XML community.
XML.com features a rich mix of information and services for the XML community.
</description>
<image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
@ -84,6 +83,10 @@ func TestParseRDFSample(t *testing.T) {
t.Errorf("Incorrect title, got: %s", feed.Title)
}
if feed.Description != "XML.com features a rich mix of information and services for the XML community." {
t.Errorf("Incorrect description, got: %s", feed.Description)
}
if feed.FeedURL != "http://xml.com/pub/rdf.xml" {
t.Errorf("Incorrect feed URL, got: %s", feed.FeedURL)
}