Add item content
Looks good so far, but there is no test for this case.
In addition, so that the generated XML is valid, the content namespace must be included:
xmlns:content="http://purl.org/rss/1.0/modules/content/"
I added it to the tests. The namespace you mentioned seems to already be included here:
https://github.com/dylang/node-rss/blob/master/lib/rss.js#L94
ping - just seeing if anyone can review my updates to the latest comment and give the thumbs up to merge?
With the current 1.1.1 release, you can add content:encoded data (or any other custom field) as follows:
var RSS = require('rss');
/* let's create an rss feed */
var feed = new RSS({
title: 'title',
description: 'description',
custom_namespaces : {
"content" : "http://purl.org/rss/1.0/modules/content/"
},
});
// Add an item/article
feed.item({
title: 'Item Title ',
description: 'The description',
custom_elements: [
{
"content:encoded":
{
_cdata: "This is the long content. <b>This & That</b>"
}
}
]
});
// generate xml with default indent (4 sp)
var xml = feed.xml({indent: true});
console.log(xml);
<?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://github.com/dylang/node-rss</link>
<generator>RSS for Node</generator>
<lastBuildDate>Mon, 22 Dec 2014 22:52:32 GMT</lastBuildDate>
<item>
<title><![CDATA[Item Title ]]></title>
<description><![CDATA[The description]]></description>
<guid isPermaLink="false">Item Title </guid>
<content:encoded><![CDATA[This is the long content. <b>This & That</b>]]></content:encoded>
</item>
</channel>
</rss>
@efuquen did the custom_namespaces functionality example shown in the previous comment accomplish the same goal as you intended with your pull request?