mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 03:56:19 +00:00
Изменён способ добавления аттрибутов на правильный
This commit is contained in:
14
.jshintrc
14
.jshintrc
@@ -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
|
||||
}
|
||||
13
lib/index.js
13
lib/index.js
@@ -48,13 +48,20 @@ function generateXML(data) {
|
||||
ifTruePush(item.related, item_values, {
|
||||
'yandex:related': item.related.map(
|
||||
function (related) {
|
||||
return '<link url="' + related.link + '" img="' + related.image_url + '">' + related.text + '</link>';
|
||||
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 = {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" xmlns:turbo="http://turbo.yandex.ru" version="2.0"><channel><title><![CDATA[title]]></title><link>http://example.com/rss.xml</link><description><![CDATA[description]]></description><language>ru</language><item turbo="true"><link>http://example.com/article4?this&that</link><turbo:source>http://example.com/article4?this&that</turbo:source><pubDate>Sat, 26 May 2012 21:00:00 GMT</pubDate><author>LightAir</author><turbo:content><![CDATA[<header><figure><img src="http://example.com/example.png" /></figure> <h1>item title</h1></header><p>hello</p>]]></turbo:content><yandex:related><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></yandex:related></item></channel></rss>
|
||||
<rss xmlns:yandex="http://news.yandex.ru" xmlns:media="http://search.yahoo.com/mrss/" xmlns:turbo="http://turbo.yandex.ru" version="2.0"><channel><title><![CDATA[title]]></title><link>http://example.com/rss.xml</link><description><![CDATA[description]]></description><language>ru</language><item turbo="true"><link>http://example.com/article4?this&that</link><turbo:source>http://example.com/article4?this&that</turbo:source><pubDate>Sat, 26 May 2012 21:00:00 GMT</pubDate><author>LightAir</author><turbo:content><![CDATA[<header><figure><img src="http://example.com/example.png" /></figure> <h1>item title</h1></header><p>hello</p>]]></turbo:content><yandex:related><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></yandex:related></item></channel></rss>
|
||||
|
||||
Reference in New Issue
Block a user