-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDATA filtering options, new item addition functions, unit tests, bug fixes #38
base: master
Are you sure you want to change the base?
Changes from 19 commits
1fab44d
23aa233
ab2ab66
87e0c77
6ac9af9
3070e49
f0fc81f
6fba453
38363d1
e23f8f6
f528b84
ff24ee9
ce46bbf
5993cd5
6478f12
65a9d42
fa4d015
5450f8d
c1f6460
603b252
ddfa350
86f2a74
706e137
8d14204
bfe54b7
cd123b6
a8cfc9e
6b7e4d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var RSS = require('../lib/index'); | ||
|
||
/* let's create an rss feed */ | ||
var feed = new RSS({ | ||
title: 'title', | ||
description: 'description', | ||
feed_url: 'http://example.com/rss.xml', | ||
site_url: 'http://example.com', | ||
image_url: 'http://example.com/icon.png', | ||
docs: 'http://example.com/rss/docs.html', | ||
managingEditor: 'Dylan Greene', | ||
webMaster: 'Dylan Greene', | ||
copyright: '2013 Dylan Greene', | ||
language: 'en', | ||
categories: ['Category 1','Category 2','Category 3'], | ||
pubDate: 'May 20, 2012 04:00:00 GMT', | ||
ttl: '60', | ||
no_cdata_fields: ['title', 'category'], | ||
customNamespaces: { | ||
'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd' | ||
}, | ||
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'}, | ||
{'itunes:owner': [ | ||
{'itunes:name': 'John Doe'}, | ||
{'itunes:email': '[email protected]'} | ||
]}, | ||
{'itunes:image': { | ||
_attr: { | ||
href: 'http://example.com/podcasts/everything/AllAboutEverything.jpg' | ||
} | ||
}}, | ||
{'itunes:category': [ | ||
{_attr: { | ||
text: 'Technology' | ||
}}, | ||
{'itunes:category': { | ||
_attr: { | ||
text: 'Gadgets' | ||
} | ||
}} | ||
]} | ||
] | ||
}); | ||
|
||
// Add an item/article too the feed | ||
feed.item({ | ||
title: 'Item Title & Fun', | ||
description: 'Use this for the content. It can include html.', | ||
url: 'http://example.com/article4?this&that', // link to the item | ||
guid: '1123', // optional - defaults to url | ||
categories: ['Category 1','Category 2'], // optional - array of item categories | ||
author: 'Guest Author', // optional - defaults to feed author property | ||
date: 'May 27, 2012', // any format that js Date can parse. | ||
lat: 33.417974, //optional latitude field for GeoRSS | ||
long: -111.933231, //optional longitude field for GeoRSS | ||
enclosure: { url: 'https://www.google.com/images/srpr/logo11w.png' }, | ||
// enclosure: {file:'path-to-file'}, // enclosure from file | ||
custom_elements: [ | ||
{'itunes:author': 'John Doe'}, | ||
{'itunes:subtitle': 'A short primer on table spices'}, | ||
{'itunes:image': { | ||
_attr: { | ||
href: 'http://example.com/podcasts/everything/AllAboutEverything/Episode1.jpg' | ||
} | ||
}}, | ||
{'itunes:duration': '7:04'} | ||
] | ||
}); | ||
|
||
// generate xml with default indent (4 sp) | ||
var xml = feed.xml({indent: true}); | ||
console.log(xml); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ | |
"Patrick Garman <[email protected]>", | ||
"Fred Morstatter", | ||
"Eric Vantillard <[email protected]>", | ||
"Jason Karns <jasonkarns>" | ||
"Jason Karns <jasonkarns>", | ||
"Kip Gebhardt <rv-kip>" | ||
], | ||
"repository": { | ||
"type": "git", | ||
|
@@ -57,10 +58,10 @@ | |
"dependencies": { | ||
"folderify": "^0.6.0", | ||
"mime-types": "^2.0.3", | ||
"mime": "^1.2.11", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I clone (or There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above :) |
||
"xml": "^1.0.0" | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already found in the regular dependencies. Npm was warning on the duplicate so I removed it. If it needs to be in both blocks, I can add it back. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ha, good find, thanks, i'll fix that right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in master |
||
"devDependencies": { | ||
"folderify": "^0.6.0", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-release": "^0.9.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## Example Usage | ||
|
||
(examples/simple.js) | ||
```js | ||
var RSS = require('rss'); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"> | ||
<channel> | ||
<title><![CDATA[title]]></title> | ||
<description><![CDATA[description]]></description> | ||
<link>http://example.com</link> | ||
<image> | ||
<url>http://example.com/icon.png</url> | ||
<title>title</title> | ||
<link>http://example.com</link> | ||
</image> | ||
<generator>Example Generator</generator> | ||
<lastBuildDate>Wed, 10 Dec 2014 19:04:57 GMT</lastBuildDate> | ||
<atom:link href="http://example.com/rss.xml" rel="self" type="application/rss+xml"/> | ||
<author><![CDATA[Dylan Greene]]></author> | ||
<pubDate>Sun, 20 May 2012 04:00:00 GMT</pubDate> | ||
<copyright><![CDATA[2013 Dylan Green]]></copyright> | ||
<language><![CDATA[en]]></language> | ||
<managingEditor><![CDATA[Dylan Green]]></managingEditor> | ||
<webMaster><![CDATA[Dylan Green]]></webMaster> | ||
<docs>http://example.com/rss/docs.html</docs> | ||
<ttl>60</ttl> | ||
<category><![CDATA[Category 1]]></category> | ||
<category><![CDATA[Category 2]]></category> | ||
<category><![CDATA[Category 3]]></category> | ||
<item> | ||
<title><![CDATA[item 1]]></title> | ||
<description><![CDATA[description 1]]></description> | ||
<link>http://example.com/article1</link> | ||
<guid isPermaLink="true">http://example.com/article1</guid> | ||
<dc:creator><![CDATA[Dylan Greene]]></dc:creator> | ||
<pubDate>Thu, 24 May 2012 04:00:00 GMT</pubDate> | ||
</item> | ||
<item> | ||
<title><![CDATA[item 2]]></title> | ||
<description><![CDATA[description 2]]></description> | ||
<link>http://example.com/article2</link> | ||
<guid isPermaLink="true">http://example.com/article2</guid> | ||
<dc:creator><![CDATA[Dylan Greene]]></dc:creator> | ||
<pubDate>Fri, 25 May 2012 04:00:00 GMT</pubDate> | ||
</item> | ||
<item> | ||
<title><![CDATA[item 3]]></title> | ||
<description><![CDATA[description 3]]></description> | ||
<link>http://example.com/article3</link> | ||
<guid isPermaLink="false">item3</guid> | ||
<dc:creator><![CDATA[Dylan Greene]]></dc:creator> | ||
<pubDate>Sat, 26 May 2012 04:00:00 GMT</pubDate> | ||
</item> | ||
<item> | ||
<title><![CDATA[item 4 & html test with <strong>]]></title> | ||
<description><![CDATA[description 4 uses some <strong>html</strong>]]></description> | ||
<link>http://example.com/article4?this&that</link> | ||
<guid isPermaLink="true">http://example.com/article4?this&that</guid> | ||
<dc:creator><![CDATA[Guest Author]]></dc:creator> | ||
<pubDate>Sun, 27 May 2012 04:00:00 GMT</pubDate> | ||
</item> | ||
<item> | ||
<title><![CDATA[item 5 & test for categories]]></title> | ||
<description><![CDATA[description 5]]></description> | ||
<link>http://example.com/article5</link> | ||
<guid isPermaLink="true">http://example.com/article5</guid> | ||
<category><![CDATA[Category 1]]></category> | ||
<category><![CDATA[Category 2]]></category> | ||
<category><![CDATA[Category 3]]></category> | ||
<category><![CDATA[Category 4]]></category> | ||
<dc:creator><![CDATA[Guest Author]]></dc:creator> | ||
<pubDate>Mon, 28 May 2012 04:00:00 GMT</pubDate> | ||
</item> | ||
</channel> | ||
</rss> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you changed this accidently back to
mime
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops!