mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 12:06:20 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17030f0b82 | ||
|
|
e7d4333b45 | ||
|
|
5c8fbfaa40 | ||
|
|
ba8fe7ed26 |
@@ -146,6 +146,7 @@ class TR {
|
||||
itemValues.push({_attr: {'turbo': item.turboEnabled ? 'true' : 'false'}});
|
||||
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.turboTopic, itemValues, {'turbo:topic': item.turboTopic});
|
||||
self.pushIfConditionTrue(item.date, itemValues, {pubDate: new Date(item.date).toUTCString()});
|
||||
@@ -218,6 +219,7 @@ class TR {
|
||||
turboTopic: data.turboTopic || '',
|
||||
goals: data.goals || [],
|
||||
turboEnabled: data.turboEnabled !== undefined ? data.turboEnabled : true,
|
||||
extendedHtml: data.extendedHtml || false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "turbo-rss",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "RSS based, feed generator for Yandex turbo",
|
||||
"keywords": [
|
||||
"yandex",
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
[](https://codeclimate.com/github/LightAir/turbo-rss/maintainability)
|
||||
[](https://codeclimate.com/github/LightAir/turbo-rss/test_coverage)
|
||||
[](https://travis-ci.org/LightAir/turbo-rss)
|
||||
[](https://www.npmjs.com/package/turbo-rss)
|
||||
[](https://app.travis-ci.com/LightAir/turbo-rss)
|
||||
[](https://www.npmjs.com/package/turbo-rss)
|
||||

|
||||
|
||||
>Генератор RSS разметки для сервиса Турбо-страницы https://yandex.ru/support/webmaster/turbo/connection.html
|
||||
|
||||
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());
|
||||
});
|
||||
|
||||
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