1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Try to use outermost element text when title is empty

This commit is contained in:
lf94 2022-04-05 21:22:06 -04:00 committed by Frédéric Guillot
parent ec2b911881
commit fa8431c5c6
2 changed files with 36 additions and 3 deletions

View file

@ -449,7 +449,34 @@ func TestParseEntryWithEmptyXHTMLTitle(t *testing.T) {
}
if feed.Entries[0].Title != `http://example.org/entry` {
t.Errorf("Incorrect entry title, got: %q", feed.Entries[1].Title)
t.Errorf("Incorrect entry title, got: %q", feed.Entries[0].Title)
}
}
func TestParseEntryWithXHTMLTitleWithoutDiv(t *testing.T) {
data := `<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<entry>
<title type="xhtml">
test
</title>
<link href="http://example.org/entry"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
</entry>
</feed>`
feed, err := Parse("https://example.org/", bytes.NewBufferString(data))
if err != nil {
t.Fatal(err)
}
if feed.Entries[0].Title != `test` {
t.Errorf("Incorrect entry title, got: %q", feed.Entries[0].Title)
}
}