A lax Web news feed parser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

95 lines
3.5 KiB

# These tests validate that format mixing works, where it is particularly relevant
# It is assumed these tests will not be exhaustive
Atom related link in RSS 2.0: # A reliable related link overrides the RSS 2.0 guessing game
input: >
<rss><channel xmlns:atom="http://www.w3.org/2005/Atom">
<item>
<guid>http://example.com/</guid>
<link>http://example.org/</link>
<atom:link rel="related" href="http://example.net/"/>
</item>
</channel></rss>
output:
format: rss
entries:
- id: 'http://example.com/'
link: 'http://example.org/'
relatedLink: 'http://example.net/'
Update and creation dates:
input: >
<rss><channel xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<item>
<pubDate>2020-03-03T00:00:00Z</pubDate>
</item>
<item>
<atom:published>2020-03-03T00:00:00Z</atom:published>
<lastBuildDate>2020-01-01T00:00:00Z</lastBuildDate>
</item>
<item>
<dc:date>2020-03-03T01:00:00+01:00</dc:date>
<pubDate>2020-03-03T00:00:00Z</pubDate>
</item>
</channel></rss>
output:
format: rss
entries:
- dateModified: '2020-03-03T00:00:00Z'
- dateCreated: '2020-03-03T00:00:00Z'
dateModified: '2020-01-01T00:00:00Z'
- dateModified: '2020-03-03T01:00:00+01:00'
Entry author:
input: >
<rss><channel xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<item>
<dc:creator>jane.doe@example.com (Jane Doe)</dc:creator>
<author>john.doe@example.com (John Doe)</author>
</item>
<item>
<dc:contributor>Larry</dc:contributor>
<author>john.doe@example.com (John Doe)</author>
</item>
<item>
<dc:contributor>Larry</dc:contributor>
<dc:contributor>Curly</dc:contributor>
<atom:source>
<author>jane.doe@example.com (Jane Doe)</author>
<dc:contributor>Moe</dc:contributor>
</atom:source>
</item>
<item>
<author>Jane Doe</author>
<atom:source>
<atom:author><atom:name>John Doe</atom:name></atom:author>
<dc:contributor>Moe</dc:contributor>
</atom:source>
</item>
</channel></rss>
output:
format: rss
entries:
- people:
- name: 'Jane Doe'
mail: 'jane.doe@example.com'
role: author
- people:
- name: 'John Doe'
mail: 'john.doe@example.com'
role: author
- name: Larry
role: contributor
- people:
- name: 'Jane Doe'
mail: 'jane.doe@example.com'
role: author
- name: Larry
role: contributor
- name: Curly
role: contributor
- name: Moe
role: contributor
- people:
- name: 'Jane Doe'
role: author