diff --git a/lib/fields.js b/lib/fields.js index b3f8d7b..964dce4 100644 --- a/lib/fields.js +++ b/lib/fields.js @@ -9,6 +9,7 @@ fields.feed = [ ['dc:type', 'type'], 'title', 'description', + 'subtitle', 'author', 'pubDate', 'webMaster', @@ -35,6 +36,7 @@ fields.item = [ ['dc:source', 'source'], ['dc:title', 'title'], 'title', + 'subtitle', 'link', 'pubDate', 'author', diff --git a/test/input/subtitle.rss b/test/input/subtitle.rss new file mode 100644 index 0000000..07ddd6d --- /dev/null +++ b/test/input/subtitle.rss @@ -0,0 +1,27 @@ + + + + Example Blog + https://example.com/blog + A blog about technology and programming + Tech insights and tutorials + en-us + Mon, 15 Jan 2024 10:00:00 GMT + + First Post + An introduction to our blog + https://example.com/blog/post-1 + Welcome to our blog! + Mon, 15 Jan 2024 10:00:00 GMT + https://example.com/blog/post-1 + + + Second Post + More content for readers + https://example.com/blog/post-2 + Here is another post. + Sun, 14 Jan 2024 09:00:00 GMT + https://example.com/blog/post-2 + + + diff --git a/test/output/subtitle.json b/test/output/subtitle.json new file mode 100644 index 0000000..01aec06 --- /dev/null +++ b/test/output/subtitle.json @@ -0,0 +1,32 @@ +{ + "feed": { + "items": [ + { + "title": "First Post", + "subtitle": "An introduction to our blog", + "link": "https://example.com/blog/post-1", + "pubDate": "Mon, 15 Jan 2024 10:00:00 GMT", + "content": "Welcome to our blog!", + "contentSnippet": "Welcome to our blog!", + "guid": "https://example.com/blog/post-1", + "isoDate": "2024-01-15T10:00:00.000Z" + }, + { + "title": "Second Post", + "subtitle": "More content for readers", + "link": "https://example.com/blog/post-2", + "pubDate": "Sun, 14 Jan 2024 09:00:00 GMT", + "content": "Here is another post.", + "contentSnippet": "Here is another post.", + "guid": "https://example.com/blog/post-2", + "isoDate": "2024-01-14T09:00:00.000Z" + } + ], + "title": "Example Blog", + "description": "A blog about technology and programming", + "subtitle": "Tech insights and tutorials", + "link": "https://example.com/blog", + "language": "en-us", + "lastBuildDate": "Mon, 15 Jan 2024 10:00:00 GMT" + } +} diff --git a/test/parser.js b/test/parser.js index 034c72f..fd7b06a 100644 --- a/test/parser.js +++ b/test/parser.js @@ -284,4 +284,8 @@ describe('Parser', function() { it('should parse atom:link pagination links', function (done) { testParseForFile('pagination-links', 'rss', done); }); + + it('should parse subtitle field in feed and items', function(done) { + testParseForFile('subtitle', 'rss', done); + }); })