From f46592e233d552de3a473cd1b4b7c4222024038f Mon Sep 17 00:00:00 2001 From: Max Nowack Date: Tue, 11 Nov 2014 18:30:54 +0100 Subject: [PATCH] changed object names to fit conventions --- lib/rss.js | 14 +++++++------- readme.md | 6 +++--- test/rss.test.js | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/rss.js b/lib/rss.js index d8bfdd1..6df7e5b 100755 --- a/lib/rss.js +++ b/lib/rss.js @@ -50,7 +50,7 @@ function generateXML (data){ }); } - ifTruePushArray(data.custom, channel, data.custom); + ifTruePushArray(data.custom_elements, channel, data.custom_elements); data.items.forEach(function(item) { var item_values = [ @@ -96,7 +96,7 @@ function generateXML (data){ } } - ifTruePushArray(item.custom, item_values, item.custom); + ifTruePushArray(item.custom_elements, item_values, item.custom_elements); channel.push({ item: item_values }); @@ -110,8 +110,8 @@ function generateXML (data){ version: '2.0' }; - for(var name in data.customNamespaces) { - _attr['xmlns:' + name] = data.customNamespaces[name]; + for(var name in data.custom_namespaces) { + _attr['xmlns:' + name] = data.custom_namespaces[name]; } //only add namespace if GeoRSS is true @@ -148,8 +148,8 @@ function RSS (options, items) { this.ttl = options.ttl; //option to return feed as GeoRSS is set automatically if feed.lat/long is used this.geoRSS = options.geoRSS || false; - this.customNamespaces = options.customNamespaces || {}; - this.custom = options.custom || []; + this.custom_namespaces = options.custom_namespaces || {}; + this.custom_elements = options.custom_elements || []; this.items = items || []; this.item = function (options) { @@ -165,7 +165,7 @@ function RSS (options, items) { lat: options.lat, long: options.long, enclosure: options.enclosure || false, - custom: options.custom || [] + custom_elements: options.custom_elements || [] }; this.items.push(item); diff --git a/readme.md b/readme.md index 7a14c93..dec8920 100644 --- a/readme.md +++ b/readme.md @@ -37,8 +37,8 @@ var feed = new RSS(feedOptions); * `pubDate` _optional_ **Date object or date string** The publication date for content in the feed * `ttl` _optional_ **integer** Number of minutes feed can be cached before refreshing from source. * `hub` _optional_ **PubSubHubbub hub url** Where is the PubSubHub hub located. - * `customNamespaces` _optional_ **object** Put additional namespaces in element (without 'xmlns:' prefix) - * `custom` _optional_ **array** Put additional elements in the feed (node-xml syntax) + * `custom_namespaces` _optional_ **object** Put additional namespaces in element (without 'xmlns:' prefix) + * `custom_elements` _optional_ **array** Put additional elements in the feed (node-xml syntax) #### Add items to a feed @@ -66,7 +66,7 @@ feed.item(itemOptions); if the content should be presented as unread. * `lat` _optional_ **number** The latitude coordinate of the item. * `long` _optional_ **number** The longitude coordinate of the item. - * `custom` _optional_ **array** Put additional elements in the item (node-xml syntax) + * `custom_elements` _optional_ **array** Put additional elements in the item (node-xml syntax) ##### Feed XML diff --git a/test/rss.test.js b/test/rss.test.js index c50ef81..39df2d6 100644 --- a/test/rss.test.js +++ b/test/rss.test.js @@ -273,7 +273,7 @@ describe('rss module', function(done) { pubDate: 'May 20, 2012 04:00:00 GMT', language: 'en', ttl: '60', - custom: [ + custom_elements: [ {'itunes:subtitle': 'A show about everything'}, {'itunes:author': 'John Doe'}, {'itunes:summary': 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store'}, @@ -304,7 +304,7 @@ describe('rss module', function(done) { description: 'description 1', url: 'http://example.com/article1', date: 'May 24, 2012 04:00:00 GMT', - custom: [ + custom_elements: [ {'itunes:author': 'John Doe'}, {'itunes:subtitle': 'A short primer on table spices'}, {'itunes:image': { @@ -370,10 +370,10 @@ describe('rss module', function(done) { pubDate: 'May 20, 2012 04:00:00 GMT', language: 'en', ttl: '60', - customNamespaces: { + custom_namespaces: { 'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd' }, - custom: [ + custom_elements: [ {'itunes:subtitle': 'A show about everything'}, {'itunes:author': 'John Doe'}, {'itunes:summary': 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store'}, @@ -404,7 +404,7 @@ describe('rss module', function(done) { description: 'description 1', url: 'http://example.com/article1', date: 'May 24, 2012 04:00:00 GMT', - custom: [ + custom_elements: [ {'itunes:author': 'John Doe'}, {'itunes:subtitle': 'A short primer on table spices'}, {'itunes:image': {