diff --git a/lib/index.js b/lib/index.js index bf6b24a..d683470 100755 --- a/lib/index.js +++ b/lib/index.js @@ -33,7 +33,7 @@ function generateXML(data) { let img = ''; let menu = ''; - if (item.img) { + if (item.image_url) { img = '
'; } @@ -41,7 +41,7 @@ function generateXML(data) { menu = '' + item.menu + ''; } - let fullContent = '
' + img + '

' + item.title + '

' + item.content + menu + '
'; + let fullContent = '
' + img + '

' + item.title + '

' + menu + '
' + item.content; item_values.push({'turbo:content': {_cdata: fullContent}}); channel.push({item: item_values}); @@ -66,7 +66,7 @@ function generateXML(data) { function YTurbo(options, items) { options = options || {}; - this.title = options.title || 'Channel Yandex RSS'; + this.title = options.title || 'Untitled'; this.description = options.description || ''; this.link = options.link; this.image_url = options.image_url; @@ -77,9 +77,10 @@ function YTurbo(options, items) { this.item = function (options) { options = options || {}; - let item = { + var item = { title: options.title || 'No title', description: options.description || '', + image_url: options.image_url, url: options.url, author: options.author, date: options.date, diff --git a/test/expectedOutput/default.xml b/test/expectedOutput/default.xml index 6f79df5..ca484e0 100644 --- a/test/expectedOutput/default.xml +++ b/test/expectedOutput/default.xml @@ -1 +1 @@ -<![CDATA[Channel Yandex RSS]]>http://github.com/LightAir/turbo-rssru +<![CDATA[Untitled]]>http://github.com/LightAir/turbo-rssru diff --git a/test/expectedOutput/defaultItem.xml b/test/expectedOutput/defaultItem.xml index b272205..35555d1 100644 --- a/test/expectedOutput/defaultItem.xml +++ b/test/expectedOutput/defaultItem.xml @@ -1 +1 @@ -<![CDATA[title]]>http://example.com/rss.xmlru

No title

undefined]]>
+<![CDATA[title]]>http://example.com/rss.xmlru

No title

undefined]]>
diff --git a/test/expectedOutput/defaultOneItem.xml b/test/expectedOutput/defaultOneItem.xml index abe3fcd..6c8d1f1 100644 --- a/test/expectedOutput/defaultOneItem.xml +++ b/test/expectedOutput/defaultOneItem.xml @@ -1 +1 @@ -<![CDATA[Channel Yandex RSS]]>http://github.com/LightAir/turbo-rssru

No title

undefined]]>
+<![CDATA[Untitled]]>http://github.com/LightAir/turbo-rssru

No title

undefined]]>