mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 03:56:19 +00:00
changed object names to fit conventions
This commit is contained in:
14
lib/rss.js
14
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);
|
||||
|
||||
@@ -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 <rss> element (without 'xmlns:' prefix)
|
||||
* `custom` _optional_ **array** Put additional elements in the feed (node-xml syntax)
|
||||
* `custom_namespaces` _optional_ **object** Put additional namespaces in <rss> 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
|
||||
|
||||
|
||||
@@ -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': {
|
||||
|
||||
Reference in New Issue
Block a user