changed object names to fit conventions

This commit is contained in:
Max Nowack
2014-11-11 18:30:54 +01:00
parent 74d7142ab4
commit f46592e233
3 changed files with 15 additions and 15 deletions

View File

@@ -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) { data.items.forEach(function(item) {
var item_values = [ 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 }); channel.push({ item: item_values });
@@ -110,8 +110,8 @@ function generateXML (data){
version: '2.0' version: '2.0'
}; };
for(var name in data.customNamespaces) { for(var name in data.custom_namespaces) {
_attr['xmlns:' + name] = data.customNamespaces[name]; _attr['xmlns:' + name] = data.custom_namespaces[name];
} }
//only add namespace if GeoRSS is true //only add namespace if GeoRSS is true
@@ -148,8 +148,8 @@ function RSS (options, items) {
this.ttl = options.ttl; this.ttl = options.ttl;
//option to return feed as GeoRSS is set automatically if feed.lat/long is used //option to return feed as GeoRSS is set automatically if feed.lat/long is used
this.geoRSS = options.geoRSS || false; this.geoRSS = options.geoRSS || false;
this.customNamespaces = options.customNamespaces || {}; this.custom_namespaces = options.custom_namespaces || {};
this.custom = options.custom || []; this.custom_elements = options.custom_elements || [];
this.items = items || []; this.items = items || [];
this.item = function (options) { this.item = function (options) {
@@ -165,7 +165,7 @@ function RSS (options, items) {
lat: options.lat, lat: options.lat,
long: options.long, long: options.long,
enclosure: options.enclosure || false, enclosure: options.enclosure || false,
custom: options.custom || [] custom_elements: options.custom_elements || []
}; };
this.items.push(item); this.items.push(item);

View File

@@ -37,8 +37,8 @@ var feed = new RSS(feedOptions);
* `pubDate` _optional_ **Date object or date string** The publication date for content in the feed * `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. * `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. * `hub` _optional_ **PubSubHubbub hub url** Where is the PubSubHub hub located.
* `customNamespaces` _optional_ **object** Put additional namespaces in <rss> element (without 'xmlns:' prefix) * `custom_namespaces` _optional_ **object** Put additional namespaces in <rss> element (without 'xmlns:' prefix)
* `custom` _optional_ **array** Put additional elements in the feed (node-xml syntax) * `custom_elements` _optional_ **array** Put additional elements in the feed (node-xml syntax)
#### Add items to a feed #### Add items to a feed
@@ -66,7 +66,7 @@ feed.item(itemOptions);
if the content should be presented as unread. if the content should be presented as unread.
* `lat` _optional_ **number** The latitude coordinate of the item. * `lat` _optional_ **number** The latitude coordinate of the item.
* `long` _optional_ **number** The longitude 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 ##### Feed XML

View File

@@ -273,7 +273,7 @@ describe('rss module', function(done) {
pubDate: 'May 20, 2012 04:00:00 GMT', pubDate: 'May 20, 2012 04:00:00 GMT',
language: 'en', language: 'en',
ttl: '60', ttl: '60',
custom: [ custom_elements: [
{'itunes:subtitle': 'A show about everything'}, {'itunes:subtitle': 'A show about everything'},
{'itunes:author': 'John Doe'}, {'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'}, {'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', description: 'description 1',
url: 'http://example.com/article1', url: 'http://example.com/article1',
date: 'May 24, 2012 04:00:00 GMT', date: 'May 24, 2012 04:00:00 GMT',
custom: [ custom_elements: [
{'itunes:author': 'John Doe'}, {'itunes:author': 'John Doe'},
{'itunes:subtitle': 'A short primer on table spices'}, {'itunes:subtitle': 'A short primer on table spices'},
{'itunes:image': { {'itunes:image': {
@@ -370,10 +370,10 @@ describe('rss module', function(done) {
pubDate: 'May 20, 2012 04:00:00 GMT', pubDate: 'May 20, 2012 04:00:00 GMT',
language: 'en', language: 'en',
ttl: '60', ttl: '60',
customNamespaces: { custom_namespaces: {
'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd' 'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd'
}, },
custom: [ custom_elements: [
{'itunes:subtitle': 'A show about everything'}, {'itunes:subtitle': 'A show about everything'},
{'itunes:author': 'John Doe'}, {'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'}, {'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', description: 'description 1',
url: 'http://example.com/article1', url: 'http://example.com/article1',
date: 'May 24, 2012 04:00:00 GMT', date: 'May 24, 2012 04:00:00 GMT',
custom: [ custom_elements: [
{'itunes:author': 'John Doe'}, {'itunes:author': 'John Doe'},
{'itunes:subtitle': 'A short primer on table spices'}, {'itunes:subtitle': 'A short primer on table spices'},
{'itunes:image': { {'itunes:image': {