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.
221 lines
5.7 KiB
221 lines
5.7 KiB
Minimal example 1:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1"
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
|
|
Minimal example 2:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1.1"
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1.1'
|
|
|
|
Correct type of member:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"title": "Example title"
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
title: 'Example title'
|
|
|
|
Incorrect type of member:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"title": 1001001
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
|
|
URL -> ID equivalence:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"feed_url": "http://example.com/"
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
id: 'http://example.com/'
|
|
url: 'http://example.com/'
|
|
|
|
Single author:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
people:
|
|
- role: author
|
|
name: John Doe
|
|
url: 'http://example.org/'
|
|
avatar: http://example.org/avatar
|
|
|
|
Multiple authors:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"authors": [
|
|
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"},
|
|
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"}
|
|
]
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
people:
|
|
- role: author
|
|
name: John Doe
|
|
url: 'http://example.org/'
|
|
avatar: http://example.org/avatar
|
|
- role: author
|
|
name: Jane Doe
|
|
url: 'http://example.net/'
|
|
avatar: http://example.net/avatar
|
|
|
|
Fallback author:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"authors": [
|
|
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"},
|
|
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"}
|
|
],
|
|
"author": {"name": "John Smith", "url": "http://example.biz/", "avatar": "http://example.biz/avatar"}
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
people:
|
|
- role: author
|
|
name: John Doe
|
|
url: 'http://example.org/'
|
|
avatar: http://example.org/avatar
|
|
- role: author
|
|
name: Jane Doe
|
|
url: 'http://example.net/'
|
|
avatar: http://example.net/avatar
|
|
|
|
Empty author:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"author": {}
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
|
|
Empty authors:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"authors": [{}]
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
|
|
Empty authors with fallback:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"authors": [{}],
|
|
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
people:
|
|
- role: author
|
|
name: John Doe
|
|
url: 'http://example.org/'
|
|
avatar: http://example.org/avatar
|
|
|
|
Expired feed:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"expired": true
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
sched:
|
|
expired: true
|
|
|
|
Not expired feed:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"expired": false
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
sched:
|
|
expired: false
|
|
|
|
Improperly expired feed: # the 'expired' JSON Feed key is explicitly a boolean
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"expired": 1
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
|
|
Multiple elements:
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"language": "en",
|
|
"title": "Example title",
|
|
"feed_url": "http://example.com/",
|
|
"home_page_url": "http://example.net/",
|
|
"description": "Example description",
|
|
"user_comment": "Example comment",
|
|
"next_url": "http://example.com/next",
|
|
"icon": "http://example.com/image",
|
|
"favicon": "http://example.com/icon"
|
|
}
|
|
output:
|
|
format: json
|
|
version: '1'
|
|
lang: en
|
|
title: Example title
|
|
id: 'http://example.com/'
|
|
url: 'http://example.com/'
|
|
link: 'http://example.net/'
|
|
summary: Example description
|
|
icon: 'http://example.com/icon'
|
|
image: 'http://example.com/image'
|
|
|
|
Relative URL resolution:
|
|
doc_url: 'http://example.com'
|
|
input: >
|
|
{
|
|
"version": "https://jsonfeed.org/version/1",
|
|
"feed_url": "feed.json"
|
|
}
|
|
output:
|
|
meta:
|
|
url: 'http://example.com'
|
|
format: json
|
|
version: '1'
|
|
id: 'feed.json'
|
|
url: ['feed.json', 'http://example.com']
|
|
|