mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 03:56:19 +00:00
Add turbo:extendedHtml to item (#8)
This commit is contained in:
@@ -146,6 +146,7 @@ class TR {
|
|||||||
itemValues.push({_attr: {'turbo': item.turboEnabled ? 'true' : 'false'}});
|
itemValues.push({_attr: {'turbo': item.turboEnabled ? 'true' : 'false'}});
|
||||||
itemValues.push({link: item.url});
|
itemValues.push({link: item.url});
|
||||||
|
|
||||||
|
self.pushIfConditionTrue(item.extendedHtml, itemValues, {'turbo:extendedHtml': 'true'});
|
||||||
self.pushIfConditionTrue(item.turboSource, itemValues, {'turbo:source': item.turboSource});
|
self.pushIfConditionTrue(item.turboSource, itemValues, {'turbo:source': item.turboSource});
|
||||||
self.pushIfConditionTrue(item.turboTopic, itemValues, {'turbo:topic': item.turboTopic});
|
self.pushIfConditionTrue(item.turboTopic, itemValues, {'turbo:topic': item.turboTopic});
|
||||||
self.pushIfConditionTrue(item.date, itemValues, {pubDate: new Date(item.date).toUTCString()});
|
self.pushIfConditionTrue(item.date, itemValues, {pubDate: new Date(item.date).toUTCString()});
|
||||||
@@ -218,6 +219,7 @@ class TR {
|
|||||||
turboTopic: data.turboTopic || '',
|
turboTopic: data.turboTopic || '',
|
||||||
goals: data.goals || [],
|
goals: data.goals || [],
|
||||||
turboEnabled: data.turboEnabled !== undefined ? data.turboEnabled : true,
|
turboEnabled: data.turboEnabled !== undefined ? data.turboEnabled : true,
|
||||||
|
extendedHtml: data.extendedHtml || false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
test/expectedOutput/extendedHtml.xml
Normal file
1
test/expectedOutput/extendedHtml.xml
Normal file
@@ -0,0 +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></link><turbo:extendedHtml>true</turbo:extendedHtml><turbo:content><![CDATA[<header><h1></h1></header>undefined]]></turbo:content></item></channel></rss>
|
||||||
@@ -200,3 +200,14 @@ test('breadcrumbs', function (t) {
|
|||||||
|
|
||||||
t.equal(feed.xml(), expectedOutput.breadcrumbs.trim());
|
t.equal(feed.xml(), expectedOutput.breadcrumbs.trim());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('item extendedHtml', function (t) {
|
||||||
|
t.plan(1);
|
||||||
|
const feed = new TR(baseOptions);
|
||||||
|
|
||||||
|
feed.item({
|
||||||
|
extendedHtml: true
|
||||||
|
});
|
||||||
|
|
||||||
|
t.equal(feed.xml(), expectedOutput.extendedHtml.trim());
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user