diff options
author | 2023-09-08 16:50:06 -0700 | |
---|---|---|
committer | 2023-09-08 17:39:49 -0700 | |
commit | 36f013670efa627883f8de3d03ff93b7b119baff (patch) | |
tree | 8e403c592f906a290ebeb756bf699bbbb9e5694f /internal/reader/rdf/parser_test.go | |
parent | 344a237af87e07c51ca73e3b6f1c23598613996d (diff) | |
download | v2-36f013670efa627883f8de3d03ff93b7b119baff.tar.gz v2-36f013670efa627883f8de3d03ff93b7b119baff.tar.zst v2-36f013670efa627883f8de3d03ff93b7b119baff.zip |
Strip HTML tags from DublinCore Creator tags
Diffstat (limited to 'internal/reader/rdf/parser_test.go')
-rw-r--r-- | internal/reader/rdf/parser_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/reader/rdf/parser_test.go b/internal/reader/rdf/parser_test.go index 52565956..67b8c569 100644 --- a/internal/reader/rdf/parser_test.go +++ b/internal/reader/rdf/parser_test.go @@ -349,6 +349,34 @@ func TestParseItemWithDublicCoreDate(t *testing.T) { } } +func TestParseItemWithEncodedHTMLInDCCreatorField(t *testing.T) { + data := `<?xml version="1.0" encoding="utf-8"?> + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> + <channel> + <title>Example</title> + <link>http://example.org</link> + </channel> + + <item> + <title>Title</title> + <description>Test</description> + <link>http://example.org/test.html</link> + <dc:creator><a href="http://example.org/author1">Author 1</a> (University 1), <a href="http://example.org/author2">Author 2</a> (University 2)</dc:creator> + <dc:date>2018-04-10T05:00:00+00:00</dc:date> + </item> + </rdf:RDF>` + + feed, err := Parse("http://example.org", bytes.NewBufferString(data)) + if err != nil { + t.Fatal(err) + } + + expectedAuthor := "Author 1 (University 1), Author 2 (University 2)" + if feed.Entries[0].Author != expectedAuthor { + t.Errorf("Incorrect entry author, got: %s, want: %s", feed.Entries[0].Author, expectedAuthor) + } +} + func TestParseItemWithoutDate(t *testing.T) { data := `<?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"> |