4 Commits

Author SHA1 Message Date
LightAir
17030f0b82 update redme 2021-11-03 20:15:03 +03:00
LightAir
e7d4333b45 update version 2021-11-03 19:59:06 +03:00
Dmitriy
5c8fbfaa40 Add turbo:extendedHtml to item (#8) 2021-11-03 19:50:58 +03:00
LightAir
ba8fe7ed26 Мелкие изменения в readme 2021-08-29 02:32:40 +03:00
5 changed files with 18 additions and 4 deletions

View File

@@ -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,
};
}
}

View File

@@ -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",

View File

@@ -2,8 +2,8 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/6525d2aabf20185b68b6/maintainability)](https://codeclimate.com/github/LightAir/turbo-rss/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/6525d2aabf20185b68b6/test_coverage)](https://codeclimate.com/github/LightAir/turbo-rss/test_coverage)
[![Build Status](https://travis-ci.org/LightAir/turbo-rss.svg)](https://travis-ci.org/LightAir/turbo-rss)
[![npm](https://img.shields.io/badge/npm%20package-1.0.7-blue.svg?longCache=true&style=flat)](https://www.npmjs.com/package/turbo-rss)
[![Build Status](https://app.travis-ci.com/LightAir/turbo-rss.svg?branch=master)](https://app.travis-ci.com/LightAir/turbo-rss)
[![npm](https://img.shields.io/badge/npm%20package-2.0.0-green.svg?longCache=true&style=flat)](https://www.npmjs.com/package/turbo-rss)
![license](https://img.shields.io/packagist/l/doctrine/orm.svg?longCache=true&style=flat)
>Генератор RSS разметки для сервиса Турбо-страницы https://yandex.ru/support/webmaster/turbo/connection.html

View 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>

View File

@@ -199,4 +199,15 @@ 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());
});