diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 0e2d0e9..0000000 --- a/.jshintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "esversion":6, - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "sub": true, - "undef": true, - "boss": true, - "eqnull": true, - "node": true -} diff --git a/lib/index.js b/lib/index.js index 81ef902..5c02245 100755 --- a/lib/index.js +++ b/lib/index.js @@ -48,13 +48,20 @@ function generateXML(data) { ifTruePush(item.related, item_values, { 'yandex:related': item.related.map( function (related) { - return '' + related.text + ''; + return { + link: [{ + _attr: { + 'url': related.link, + 'img': related.image_url + } + }, related.text] + }; } - ).join('') + ) }); } - channel.push({item: item_values}); + channel.push({item: item_values}); }); let _attr = { diff --git a/test/expectedOutput/relatedItem.xml b/test/expectedOutput/relatedItem.xml index 651e107..27b321f 100644 --- a/test/expectedOutput/relatedItem.xml +++ b/test/expectedOutput/relatedItem.xml @@ -1 +1 @@ -<![CDATA[title]]>http://example.com/rss.xmlruhttp://example.com/article4?this&thathttp://example.com/article4?this&thatSat, 26 May 2012 21:00:00 GMTLightAir

item title

hello

]]>
<link url="http://example.com/related/post1" img="http://example.com/i/img1.jpg">related link text 1</link><link url="http://example.com/related/post2" img="http://example.com/i/img2.jpg">related link text 2</link>
+<![CDATA[title]]>http://example.com/rss.xmlruhttp://example.com/article4?this&thathttp://example.com/article4?this&thatSat, 26 May 2012 21:00:00 GMTLightAir

item title

hello

]]>
related link text 1related link text 2