Comparing version 0.0.1 to 0.0.2
@@ -8,3 +8,4 @@ | ||
link: 'http://www.amphibiousrodentsclub.com', | ||
description: 'Where we share our thoughts about amphibiosu rodents' | ||
description: 'Where we share our thoughts about amphibiosu rodents', | ||
lastBuildDate: Date.now() | ||
}); | ||
@@ -11,0 +12,0 @@ |
@@ -17,10 +17,9 @@ | ||
self._text = text.text; | ||
}; | ||
if (text.attrs) { | ||
attrs = text.attrs; | ||
} else { | ||
delete text.text; | ||
attrs = text; | ||
}; | ||
attrs = attrs | ||
|| text.attrs | ||
|| text.attr | ||
|| text; | ||
break; | ||
@@ -68,3 +67,9 @@ case 'string': | ||
Element.prototype.appendChild = function(element) { | ||
this._text += element.toString(); | ||
var children = Array.prototype.slice.call(arguments); | ||
var length = children.length; | ||
for (var i=0; i<length; i++) { | ||
this._text += children[i].toString(); | ||
}; | ||
return this; | ||
@@ -71,0 +76,0 @@ }; |
@@ -67,2 +67,7 @@ | ||
RSS.prototype.appendChild = function(element) { | ||
this.elements[element._name] = element; | ||
this.lastModified = Date.now(); | ||
}; | ||
/** | ||
@@ -103,14 +108,14 @@ * Set option | ||
/** | ||
* Update publication date | ||
* Update an element's date text | ||
*/ | ||
RSS.prototype.setPubDate = setPubDate; | ||
RSS.prototype.updateDate = updateDate; | ||
function setPubDate() { | ||
var pubDate = this.elements.pubDate; | ||
function updateDate(type) { | ||
var element = this.elements[type]; | ||
if (!pubDate) return; | ||
if (!element) return; | ||
// Update the `pubDate` element's text value | ||
pubDate.text(this.dateString()); | ||
// Update element text for new date | ||
element.text(this.dateString()); | ||
}; | ||
@@ -156,4 +161,4 @@ | ||
// Update publish date | ||
this.setPubDate(); | ||
// Update build date | ||
this.updateDate('lastBuildDate'); | ||
@@ -225,4 +230,7 @@ return item; | ||
this.lastRendered = now; | ||
// Update publish date | ||
this.updateDate('pubDate'); | ||
return result; | ||
}; |
{ | ||
"name": "diffuse", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "RSS generator", | ||
@@ -5,0 +5,0 @@ "keywords": ["rss"], |
@@ -9,3 +9,2 @@ #Diffuse | ||
var RSS = require('diffuse'); | ||
var http = require('http'); | ||
@@ -54,7 +53,7 @@ var feed = RSS.createFeed({ | ||
Some elements are required according to [RSS spec](http://cyber.law.harvard.edu/rss/rss.html#requiredChannelElements), and these are created for you automatically. Usually you would at least prefer to specify a `title`, `link` and a `description`, but diffuse will accept anything you throw at it. Unlike `createFeed`, `createItem` does not have any defaults. | ||
Some elements are required according to [RSS spec](http://cyber.law.harvard.edu/rss/rss.html#requiredChannelElements), and these are created for you automatically. Usually you would at least prefer to specify a `title`, `link` and a `description`, but diffuse will accept anything you throw at it. | ||
**Adding items** | ||
Call `#addItem` to add an item to your feed. This behaves similarly to `createFeed`, by building whatever elements you provide it. | ||
Call `#addItem` to add an item to your feed. This behaves similarly to `createFeed`, by building whatever elements you provide it. Unlike `createFeed`, this does not have any defaults. | ||
@@ -94,4 +93,2 @@ ```js | ||
item.set('title', 'My modified title. I didn\'t mean to say butt. Silly me.' | ||
item.title.set('text', 'Hello '); | ||
item.title.set('text', item.title.get('text') + 'world'); | ||
item.title.set('attrs', { href: 'www.example.com' }); | ||
@@ -98,0 +95,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13177
327
112